diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 9821e42a32..acfdeb4045 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 14cbb8312b..5c2bdafafd 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATETIME_TRUNC(ds, day) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index 013fa89b0d..d478aab86e 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATETIME_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 580dd8baf1..2d192fb79d 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_time_constraint__plan0_optimized.sql index dd7883c842..0df77ffb03 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index 1a40450467..c0a7cb56b3 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 0db2a5d863..6c179cce7f 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 9e6683d2ca..1269c6a617 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index 794b4fbae3..121a8a2629 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 19067e0b9a..b06e52d6cf 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 5c03983d10..9a873c7c98 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index c0bf988aa1..ab787834c1 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 173af1eafe..af0cf0df22 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 44d69f4ac3..1cf9773de6 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index f811654de8..424adfe6b6 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index 556940ffc0..9abb791996 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 72ba35c158..915716e167 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index 1932d15f0a..402c6443d7 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN '2020-01-01' AND '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_categorical_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_categorical_filter__plan0_optimized.sql index e5746c490a..4485f78bd4 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_categorical_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_categorical_filter__plan0_optimized.sql @@ -12,7 +12,6 @@ FROM ( , MAX(subq_30.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -21,12 +20,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_17 + ) subq_18 WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_time_constraint__plan0_optimized.sql index 0702a5a11a..156f22dc55 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_time_constraint__plan0_optimized.sql @@ -10,8 +10,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id'] -- Aggregate Measures SELECT visit__referrer_id @@ -19,17 +17,15 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id'] SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , referrer_id AS visit__referrer_id + referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY visit__referrer_id ) subq_23 diff --git a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql index d1f1fbe641..585b86b4a1 100644 --- a/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_conversion_metric_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_with_window_and_time_constraint__plan0_optimized.sql @@ -12,8 +12,6 @@ FROM ( , MAX(subq_34.buys) AS buys FROM ( -- Constrain Output with WHERE - -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,17 +20,16 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_19 - WHERE ( - metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02' - ) AND ( - visit__referrer_id = 'ref_id_01' - ) + WHERE DATE_TRUNC('day', ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02' + ) subq_21 + WHERE visit__referrer_id = 'ref_id_01' GROUP BY metric_time__day , visit__referrer_id diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/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_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/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_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/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_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/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_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_filters__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( FROM ( -- Combine Aggregated Outputs SELECT - MAX(subq_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_filters__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( FROM ( -- Combine Aggregated Outputs SELECT - MAX(subq_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql index 48eb081fdc..587ebb6267 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_filters__plan0_optimized.sql @@ -8,9 +8,9 @@ FROM ( FROM ( -- Combine Aggregated Outputs SELECT - MAX(subq_45.average_booking_value) AS average_booking_value - , MAX(subq_45.bookings) AS bookings - , MAX(subq_52.booking_value) AS booking_value + MAX(subq_44.average_booking_value) AS average_booking_value + , MAX(subq_44.bookings) AS bookings + , MAX(subq_51.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE -- Pass Only Elements: ['average_booking_value', 'bookings'] @@ -23,38 +23,30 @@ FROM ( -- Join Standard Outputs -- Pass Only Elements: ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'booking__is_instant'] SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , subq_36.bookings AS bookings - , subq_36.average_booking_value AS average_booking_value + subq_35.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.is_lux AS listing__is_lux_latest + , subq_35.bookings AS bookings + , subq_35.average_booking_value AS average_booking_value FROM ( - -- Constrain Output with WHERE + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' -- Pass Only Elements: ['average_booking_value', 'bookings', 'booking__is_instant', 'listing'] SELECT - listing - , bookings - , average_booking_value - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - listing_id AS listing - , is_instant AS booking__is_instant - , 1 AS bookings - , booking_value AS average_booking_value - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_34 - WHERE booking__is_instant - ) subq_36 + listing_id AS listing + , is_instant AS booking__is_instant + , 1 AS bookings + , booking_value AS average_booking_value + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_35 LEFT OUTER JOIN ***************************.dim_listings_latest listings_latest_src_28000 ON - subq_36.listing = listings_latest_src_28000.listing_id - ) subq_41 - WHERE listing__is_lux_latest - ) subq_45 + subq_35.listing = listings_latest_src_28000.listing_id + ) subq_40 + WHERE (listing__is_lux_latest) AND (booking__is_instant) + ) subq_44 CROSS JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant'] -- Pass Only Elements: ['booking_value',] -- Aggregate Measures -- Compute Metrics via Expressions @@ -63,12 +55,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant'] SELECT is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 ) subq_47 WHERE booking__is_instant - ) subq_52 - ) subq_53 -) subq_54 + ) subq_51 + ) subq_52 +) subq_53 diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql index 16038f3eef..803f2dc0b1 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.third_hop_table third_hop_table_src_22000 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -24,12 +23,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'customer_other_data' -- Metric Time Dimension 'acquired_ds' + -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id'] SELECT customer_third_hop_id AS customer_id__customer_third_hop_id , country AS customer_id__country , 1 AS customers_with_other_data FROM ***************************.customer_other_data customer_other_data_src_22000 - ) subq_20 + ) subq_21 WHERE customer_id__country = 'paraguay' GROUP BY customer_id__customer_third_hop_id diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_query_filters__plan0_optimized.sql index 470a0ea175..2f20ea05f2 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,37 +11,38 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY metric_time__day , user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index 5b570bda0a..22c9ea369d 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATETIME_TRUNC(ds, day) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATETIME_TRUNC(bookings_source_src_28000.ds, day) <= subq_17.ds + ) AND ( + DATETIME_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 2 day) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > DATE_SUB(CAST(subq_18.ds AS DATETIME), INTERVAL 2 day) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY metric_time__day , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index 2eceb11e8d..b483bb7a26 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index 69b22f2109..f155ad58ce 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,37 +24,38 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY metric_time__day , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 106db96ed1..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 9a96aa08db..f8cd2e9126 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,38 +11,39 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY metric_time__day , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index f1b60a40af..5a02d6faae 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_single_categorical_dimension_pushdown__plan0_optimized.sql index c189a92ec9..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_query_filters__plan0_optimized.sql index 85c395ba88..fc20b83581 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index a055d447cb..4ca92ec05c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_17.ds) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > DATEADD(day, -2, subq_18.ds) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index e2a4b4328a..6f2a446f78 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index fa9dd7b4cb..8cea815a63 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 1f66c755da..f13113bba8 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql index 8e0233d5e3..61e0c5aeec 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index 8511580120..e1192adce6 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_17.ds - INTERVAL 2 day + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > subq_18.ds - INTERVAL 2 day - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index e2a4b4328a..6f2a446f78 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index d968e659d1..5197e5dca7 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 57d56fe5d4..193672befc 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_query_filters__plan0_optimized.sql index a008821219..64717e94ef 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index 91232f5296..aa698dcbbd 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_17.ds - MAKE_INTERVAL(days => 2) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > subq_18.ds - MAKE_INTERVAL(days => 2) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index 4eef6d0c9d..78c0c33a50 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index 5fcdf34b3a..68cacecfd5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 5c4d5d69cd..a4320515ef 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_query_filters__plan0_optimized.sql index d274e2363c..21e5bde3f3 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index a055d447cb..4ca92ec05c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_17.ds) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > DATEADD(day, -2, subq_18.ds) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index 4eef6d0c9d..78c0c33a50 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index fa9dd7b4cb..8cea815a63 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 1f66c755da..f13113bba8 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_query_filters__plan0_optimized.sql index 0c600c47f3..78e9355b9a 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index a055d447cb..4ca92ec05c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_17.ds) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > DATEADD(day, -2, subq_18.ds) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index e2a4b4328a..6f2a446f78 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index fa9dd7b4cb..8cea815a63 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 1f66c755da..f13113bba8 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_query_filters__plan0_optimized.sql index dedd0635a2..8c837d9664 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_conversion_metric_query_filters__plan0_optimized.sql @@ -11,40 +11,41 @@ FROM ( , MAX(subq_37.visits) AS visits , MAX(subq_54.buys) AS buys FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['visits', 'user__home_state_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_31.metric_time__day AS metric_time__day - , users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_31.visits) AS visits + metric_time__day + , user__home_state_latest + , SUM(visits) AS visits FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['visits', 'user__home_state_latest', 'visit__referrer_id', 'metric_time__day'] SELECT - metric_time__day - , subq_29.user - , visits + subq_30.metric_time__day AS metric_time__day + , subq_30.visit__referrer_id AS visit__referrer_id + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_30.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , user_id AS user , referrer_id AS visit__referrer_id , 1 AS visits FROM ***************************.fct_visits visits_source_src_28000 - ) subq_29 - WHERE visit__referrer_id = '123456' - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 - ON - subq_31.user = users_latest_src_28000.user_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_30.user = users_latest_src_28000.user_id + ) subq_34 + WHERE visit__referrer_id = '123456' GROUP BY - subq_31.metric_time__day - , users_latest_src_28000.home_state_latest + metric_time__day + , user__home_state_latest ) subq_37 FULL OUTER JOIN ( -- Join Standard Outputs diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql index 491a5cd358..9212dd07f5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_query_time_filters__plan0_optimized.sql @@ -1,49 +1,43 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookers', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_20.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , COUNT(DISTINCT subq_20.bookers) AS every_two_days_bookers + metric_time__day + , listing__country_latest + , COUNT(DISTINCT bookers) AS every_two_days_bookers FROM ( - -- Join Self Over Time Range - -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookers', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - subq_18.ds AS metric_time__day - , subq_16.listing AS listing - , subq_16.bookers AS bookers - FROM ***************************.mf_time_spine subq_18 - INNER JOIN ( - -- Constrain Output with WHERE + subq_19.metric_time__day AS metric_time__day + , subq_19.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_19.bookers AS bookers + FROM ( + -- Join Self Over Time Range + -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT - metric_time__day - , listing - , bookers - FROM ( - -- Read Elements From Semantic Model 'bookings_source' - -- Metric Time Dimension 'ds' - SELECT - DATE_TRUNC('day', ds) AS metric_time__day - , listing_id AS listing - , is_instant AS booking__is_instant - , guest_id AS bookers - FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_15 - WHERE booking__is_instant - ) subq_16 + subq_17.ds AS metric_time__day + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.is_instant AS booking__is_instant + , bookings_source_src_28000.guest_id AS bookers + FROM ***************************.mf_time_spine subq_17 + INNER JOIN + ***************************.fct_bookings bookings_source_src_28000 + ON + ( + DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_17.ds + ) AND ( + DATE_TRUNC('day', bookings_source_src_28000.ds) > DATE_ADD('day', -2, subq_17.ds) + ) + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 ON - ( - subq_16.metric_time__day <= subq_18.ds - ) AND ( - subq_16.metric_time__day > DATE_ADD('day', -2, subq_18.ds) - ) -) subq_20 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_20.listing = listings_latest_src_28000.listing_id + subq_19.listing = listings_latest_src_28000.listing_id +) subq_24 +WHERE booking__is_instant GROUP BY - subq_20.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql index e2a4b4328a..6f2a446f78 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_different_filters_on_same_measure_source_categorical_dimension__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.max_booking_value) AS max_booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['average_booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value AS average_booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql index 928108e863..e7e610df25 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0_optimized.sql @@ -24,40 +24,41 @@ FROM ( , subq_44.bookings AS bookings FROM ***************************.mf_time_spine subq_46 LEFT OUTER JOIN ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures SELECT - subq_37.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_37.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_36.metric_time__day AS metric_time__day + , subq_36.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_36.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_35 - WHERE booking__is_instant - ) subq_37 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_37.listing = listings_latest_src_28000.listing_id + ) subq_36 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_36.listing = listings_latest_src_28000.listing_id + ) subq_41 + WHERE booking__is_instant GROUP BY - subq_37.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_44 ON subq_46.ds = subq_44.metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql index 7dadffd239..660d3f8e29 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_multiple_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,32 +1,34 @@ --- Join Standard Outputs --- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] +-- Constrain Output with WHERE -- Pass Only Elements: ['listings', 'user__home_state_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - users_latest_src_28000.home_state_latest AS user__home_state_latest - , SUM(subq_13.listings) AS listings + user__home_state_latest + , SUM(listings) AS listings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] + -- Join Standard Outputs + -- Pass Only Elements: ['listings', 'user__home_state_latest', 'listing__is_lux_latest', 'listing__capacity_latest'] SELECT - subq_11.user - , listings + subq_12.listing__is_lux_latest AS listing__is_lux_latest + , subq_12.listing__capacity_latest AS listing__capacity_latest + , users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_12.listings AS listings FROM ( -- Read Elements From Semantic Model 'listings_latest' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] SELECT user_id AS user , is_lux AS listing__is_lux_latest , capacity AS listing__capacity_latest , 1 AS listings FROM ***************************.dim_listings_latest listings_latest_src_28000 - ) subq_11 - WHERE listing__is_lux_latest OR listing__capacity_latest > 4 -) subq_13 -LEFT OUTER JOIN - ***************************.dim_users_latest users_latest_src_28000 -ON - subq_13.user = users_latest_src_28000.user_id + ) subq_12 + LEFT OUTER JOIN + ***************************.dim_users_latest users_latest_src_28000 + ON + subq_12.user = users_latest_src_28000.user_id +) subq_16 +WHERE listing__is_lux_latest OR listing__capacity_latest > 4 GROUP BY - users_latest_src_28000.home_state_latest + user__home_state_latest diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0_optimized.sql index 0353ef9ebd..ac83e4994e 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0_optimized.sql @@ -11,41 +11,42 @@ FROM ( , MAX(subq_39.bookings) AS bookings , MAX(subq_54.bookings_2_weeks_ago) AS bookings_2_weeks_ago FROM ( - -- Join Standard Outputs - -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] + -- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - subq_31.metric_time__day AS metric_time__day - , listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_31.bookings) AS bookings + metric_time__day + , listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant', 'metric_time__day'] SELECT - metric_time__day - , listing - , bookings + subq_30.metric_time__day AS metric_time__day + , subq_30.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_30.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_29 - WHERE booking__is_instant - ) subq_31 - LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 - ON - subq_31.listing = listings_latest_src_28000.listing_id + ) subq_30 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_30.listing = listings_latest_src_28000.listing_id + ) subq_35 + WHERE booking__is_instant GROUP BY - subq_31.metric_time__day - , listings_latest_src_28000.country + metric_time__day + , listing__country_latest ) subq_39 FULL OUTER JOIN ( -- Constrain Output with WHERE diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql index 8892599ad9..6e8a46fe3b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_pushdown_filter_application__plan0_optimized.sql @@ -13,7 +13,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -22,12 +21,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_single_categorical_dimension_pushdown__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_single_categorical_dimension_pushdown__plan0_optimized.sql index d243d87372..31b5d1e8d5 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_single_categorical_dimension_pushdown__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_single_categorical_dimension_pushdown__plan0_optimized.sql @@ -1,31 +1,32 @@ --- Join Standard Outputs --- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] +-- Constrain Output with WHERE -- Pass Only Elements: ['bookings', 'listing__country_latest'] -- Aggregate Measures -- Compute Metrics via Expressions SELECT - listings_latest_src_28000.country AS listing__country_latest - , SUM(subq_14.bookings) AS bookings + listing__country_latest + , SUM(bookings) AS bookings FROM ( - -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] + -- Join Standard Outputs + -- Pass Only Elements: ['bookings', 'listing__country_latest', 'booking__is_instant'] SELECT - listing - , bookings + subq_13.booking__is_instant AS booking__is_instant + , listings_latest_src_28000.country AS listing__country_latest + , subq_13.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] SELECT listing_id AS listing , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_12 - WHERE booking__is_instant -) subq_14 -LEFT OUTER JOIN - ***************************.dim_listings_latest listings_latest_src_28000 -ON - subq_14.listing = listings_latest_src_28000.listing_id + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_28000 + ON + subq_13.listing = listings_latest_src_28000.listing_id +) subq_18 +WHERE booking__is_instant GROUP BY - listings_latest_src_28000.country + listing__country_latest diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 3966cc5f91..efac34f0c1 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 25731bfc96..13fca71a38 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 6e61e1a06a..a465dac6f6 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 6e61e1a06a..a465dac6f6 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql index cfa9843dc9..e3a93f4824 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql index cfa9843dc9..e3a93f4824 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 6e61e1a06a..a465dac6f6 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql index 6e61e1a06a..a465dac6f6 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( , MAX(subq_24.booking_value) AS booking_value FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['booking_value', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -20,12 +19,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['booking_value', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , booking_value FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_14 + ) subq_15 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql index 478c021663..3202b9915d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -4,7 +4,6 @@ SELECT , delayed_bookings * 2 AS double_counted_delayed_bookings FROM ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures -- Compute Metrics via Expressions @@ -14,12 +13,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_8 + ) subq_9 WHERE NOT booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index ecb1ad0528..4ecdfebc25 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 41be8cd7d5..2b1b12de20 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/BigQuery/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATETIME_TRUNC(ds, day) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Databricks/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/DuckDB/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Postgres/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Redshift/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Snowflake/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql index 9a4f540d4c..1185bf668d 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_filter__plan0_optimized.sql @@ -10,7 +10,6 @@ FROM ( FROM ***************************.mf_time_spine subq_16 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Pass Only Elements: ['bookings', 'metric_time__day'] -- Aggregate Measures SELECT @@ -19,12 +18,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day diff --git a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql index 19f81cdd9b..476eccde2c 100644 --- a/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_time_spine_join_rendering.py/SqlQueryPlan/Trino/test_simple_join_to_time_spine_with_queried_filter__plan0_optimized.sql @@ -18,7 +18,6 @@ FROM ( FROM ***************************.mf_time_spine subq_15 LEFT OUTER JOIN ( -- Constrain Output with WHERE - -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] -- Aggregate Measures SELECT metric_time__day @@ -27,12 +26,13 @@ FROM ( FROM ( -- Read Elements From Semantic Model 'bookings_source' -- Metric Time Dimension 'ds' + -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day'] SELECT DATE_TRUNC('day', ds) AS metric_time__day , is_instant AS booking__is_instant , 1 AS bookings FROM ***************************.fct_bookings bookings_source_src_28000 - ) subq_10 + ) subq_11 WHERE booking__is_instant GROUP BY metric_time__day