diff --git a/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__after_pruning.sql b/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__after_pruning.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__after_pruning.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b diff --git a/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__before_pruning.sql b/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__before_pruning.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_column_pruner.py/SqlQueryPlan/test_prune_distinct_select__before_pruning.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml index 76ef510cce..77ef9e9b24 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml @@ -16,6 +16,7 @@ + @@ -41,6 +42,7 @@ + @@ -64,6 +66,7 @@ + @@ -79,6 +82,7 @@ + @@ -436,6 +440,7 @@ + @@ -458,6 +463,7 @@ + @@ -687,6 +693,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index bd7bff1c0a..a20f2ab36a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -16,6 +16,7 @@ + @@ -43,6 +44,7 @@ + @@ -60,6 +62,7 @@ + @@ -85,6 +88,7 @@ + @@ -104,6 +108,7 @@ + @@ -131,6 +136,7 @@ + @@ -150,6 +156,7 @@ + @@ -547,6 +554,7 @@ + @@ -904,6 +912,7 @@ + @@ -927,6 +936,7 @@ + @@ -1200,6 +1210,7 @@ + @@ -1429,6 +1440,7 @@ + @@ -1458,6 +1470,7 @@ + @@ -1483,6 +1496,7 @@ + @@ -1502,6 +1516,7 @@ + @@ -1529,6 +1544,7 @@ + @@ -1548,6 +1564,7 @@ + @@ -1793,6 +1810,7 @@ + @@ -1994,6 +2012,7 @@ + @@ -2017,6 +2036,7 @@ + @@ -2290,6 +2310,7 @@ + @@ -2519,6 +2540,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml index 673a308906..b8ea0e4a87 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml @@ -16,6 +16,7 @@ + @@ -45,6 +46,7 @@ + @@ -72,6 +74,7 @@ + @@ -91,6 +94,7 @@ + @@ -448,6 +452,7 @@ + @@ -470,6 +475,7 @@ + @@ -699,6 +705,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml index 26438e6ad2..d54260dadb 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -16,6 +16,7 @@ + @@ -41,6 +42,7 @@ + @@ -64,6 +66,7 @@ + @@ -79,6 +82,7 @@ + @@ -436,6 +440,7 @@ + @@ -458,6 +463,7 @@ + @@ -687,6 +693,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml index f502fba68f..2b515cea56 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml @@ -17,6 +17,7 @@ + @@ -34,6 +35,7 @@ + @@ -49,6 +51,7 @@ + @@ -406,6 +409,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml index 507d162fbc..43d205cc89 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml @@ -10,6 +10,7 @@ + @@ -367,6 +368,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml index 4ca58fa593..031d207292 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml @@ -13,6 +13,7 @@ + @@ -28,6 +29,7 @@ + @@ -385,6 +387,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index da4b9f2c53..f15986b92a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -22,6 +22,7 @@ + @@ -31,6 +32,7 @@ + @@ -54,6 +56,7 @@ + @@ -79,6 +82,7 @@ + @@ -98,6 +102,7 @@ + @@ -495,6 +500,7 @@ + @@ -852,6 +858,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index da4b9f2c53..f15986b92a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -22,6 +22,7 @@ + @@ -31,6 +32,7 @@ + @@ -54,6 +56,7 @@ + @@ -79,6 +82,7 @@ + @@ -98,6 +102,7 @@ + @@ -495,6 +500,7 @@ + @@ -852,6 +858,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml index da4b9f2c53..f15986b92a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -22,6 +22,7 @@ + @@ -31,6 +32,7 @@ + @@ -54,6 +56,7 @@ + @@ -79,6 +82,7 @@ + @@ -98,6 +102,7 @@ + @@ -495,6 +500,7 @@ + @@ -852,6 +858,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml index 9040ebdb0c..4d73ee2270 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml @@ -20,6 +20,7 @@ + @@ -43,6 +44,7 @@ + @@ -400,6 +402,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml index 86d176f9cb..3268ab93ba 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml @@ -32,6 +32,7 @@ + @@ -47,6 +48,7 @@ + @@ -404,6 +406,7 @@ + @@ -426,6 +429,7 @@ + @@ -655,6 +659,7 @@ + @@ -677,6 +682,7 @@ + @@ -906,6 +912,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml index 402e2ef39d..76e0ba86fd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml @@ -24,6 +24,7 @@ + @@ -41,6 +42,7 @@ + @@ -66,6 +68,7 @@ + @@ -85,6 +88,7 @@ + @@ -442,6 +446,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml index 3b31be5065..187f6f44d1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml @@ -126,6 +126,7 @@ + @@ -247,6 +248,7 @@ + @@ -262,6 +264,7 @@ + @@ -383,6 +386,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml index c4d1d06282..364d97e86d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml @@ -126,6 +126,7 @@ + @@ -247,6 +248,7 @@ + @@ -270,6 +272,7 @@ + @@ -391,6 +394,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml index c65adb8572..c877290f10 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml @@ -126,6 +126,7 @@ + @@ -247,6 +248,7 @@ + @@ -270,6 +272,7 @@ + @@ -391,6 +394,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml index 48afce360f..ab795d1fad 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml @@ -18,6 +18,7 @@ + @@ -33,6 +34,7 @@ + @@ -390,6 +392,7 @@ + @@ -412,6 +415,7 @@ + @@ -641,6 +645,7 @@ + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml index 89948cc666..13fda71ede 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml @@ -356,6 +356,7 @@ + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml index 2e1a787a23..18da8dd77c 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml @@ -348,6 +348,7 @@ + @@ -705,6 +706,7 @@ + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml index db9f23a206..74cd78ad59 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml @@ -396,6 +396,7 @@ + @@ -753,6 +754,7 @@ + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml index e8cd14dee9..3ade70ad35 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml @@ -26,6 +26,7 @@ + @@ -39,6 +40,7 @@ + @@ -56,6 +58,7 @@ + @@ -71,6 +74,7 @@ + @@ -468,6 +472,7 @@ + @@ -825,6 +830,7 @@ + @@ -848,6 +854,7 @@ + @@ -865,6 +872,7 @@ + @@ -880,6 +888,7 @@ + @@ -1229,6 +1238,7 @@ + @@ -1586,6 +1596,7 @@ + diff --git a/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__after_reducing.sql b/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__after_reducing.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__after_reducing.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b diff --git a/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__before_reducing.sql b/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__before_reducing.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_rewriting_sub_query_reducer.py/SqlQueryPlan/test_rewriting_distinct_select_node_is_not_reduced__before_reducing.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b diff --git a/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__after_reducing.sql b/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__after_reducing.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__after_reducing.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b diff --git a/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__before_reducing.sql b/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__before_reducing.sql new file mode 100644 index 0000000000..9acdadd458 --- /dev/null +++ b/metricflow/test/snapshots/test_sub_query_reducer.py/SqlQueryPlan/test_distinct_select_node_is_not_reduced__before_reducing.sql @@ -0,0 +1,10 @@ +-- test0 +SELECT + a.booking_value +FROM ( + -- test1 + SELECT DISTINCT + a.booking_value + , a.bookings + FROM demo.fct_bookings a +) b