From 12c555f22b638ad7798c7ca75e3773f35b3725c1 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Tue, 24 Sep 2024 15:32:35 -0700 Subject: [PATCH 1/2] Bug fix: use parent column expr in custom grain join condition in case column gets pruned --- metricflow/plan_conversion/dataflow_to_sql.py | 19 ++++++++++++++----- metricflow/sql/optimizer/column_pruner.py | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index b49a85a3c2..d00a41d53e 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -1441,23 +1441,32 @@ def visit_join_to_custom_granularity_node(self, node: JoinToCustomGranularityNod if instance.spec == node.time_dimension_spec.with_base_grain(): parent_time_dimension_instance = instance break + parent_column: Optional[SqlSelectColumn] = None assert parent_time_dimension_instance, ( "JoinToCustomGranularityNode's expected time_dimension_spec not found in parent dataset instances. " - "This indicates internal misconfiguration." + f"This indicates internal misconfiguration. Expected: {node.time_dimension_spec.with_base_grain}; " + f"Got: {[instance.spec for instance in parent_data_set.instance_set.time_dimension_instances]}" + ) + for select_column in parent_data_set.checked_sql_select_node.select_columns: + if select_column.column_alias == parent_time_dimension_instance.associated_column.column_name: + parent_column = select_column + break + assert parent_column, ( + "JoinToCustomGranularityNode's expected time_dimension_spec not found in parent columns. " + f"This indicates internal misconfiguration. Expected: " + f"{parent_time_dimension_instance.associated_column.column_name}; Got: " + f"{[column.column_alias for column in parent_data_set.checked_sql_select_node.select_columns]}" ) # Build join expression. time_spine_alias = self._next_unique_table_alias() custom_granularity_name = node.time_dimension_spec.time_granularity.name time_spine_source = self._get_time_spine_for_custom_granularity(custom_granularity_name) - left_expr_for_join: SqlExpressionNode = SqlColumnReferenceExpression.from_table_and_column_names( - table_alias=parent_alias, column_name=parent_time_dimension_instance.associated_column.column_name - ) join_description = SqlJoinDescription( right_source=SqlTableNode.create(sql_table=time_spine_source.spine_table), right_source_alias=time_spine_alias, on_condition=SqlComparisonExpression.create( - left_expr=left_expr_for_join, + left_expr=parent_column.expr, comparison=SqlComparison.EQUALS, right_expr=SqlColumnReferenceExpression.from_table_and_column_names( table_alias=time_spine_alias, column_name=time_spine_source.base_column diff --git a/metricflow/sql/optimizer/column_pruner.py b/metricflow/sql/optimizer/column_pruner.py index d8a4cf5340..2f44a1277f 100644 --- a/metricflow/sql/optimizer/column_pruner.py +++ b/metricflow/sql/optimizer/column_pruner.py @@ -122,6 +122,8 @@ def visit_select_statement_node(self, node: SqlSelectStatementNode) -> SqlQueryP or select_column in node.group_bys or node.distinct ) + # TODO: don't prune columns used in join condition! Tricky to derive since the join condition can be any + # SqlExpressionNode. if len(pruned_select_columns) == 0: raise RuntimeError("All columns have been pruned - this indicates an bug in the pruner or in the inputs.") From e0ea989f155391b74c74cc6e94cd3d64ba76bc0a Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Tue, 24 Sep 2024 15:35:57 -0700 Subject: [PATCH 2/2] Update snapshots --- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- ...ic_custom_granularity_joined_to_non_default_grain__plan0.sql | 2 +- ...granularity_joined_to_non_default_grain__plan0_optimized.sql | 2 +- .../test_no_metric_custom_granularity_metric_time__plan0.sql | 2 +- ...o_metric_custom_granularity_metric_time__plan0_optimized.sql | 2 +- ...test_no_metric_custom_granularity_non_metric_time__plan0.sql | 2 +- ...tric_custom_granularity_non_metric_time__plan0_optimized.sql | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index 7f1c51e890..22ead24ff1 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index 7f9f4e6bf2..ef952dadeb 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATETIME_TRUNC(time_spine_src_28006.ds, day) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0.sql index 5537bc51d0..fbd38d9bc3 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index dd697c7244..65fa31ad37 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATETIME_TRUNC(time_spine_src_28006.ds, day) = subq_4.ds GROUP BY metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0.sql index ba3dc0dcaa..36bcef7005 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) = subq_0.ds ) subq_1 GROUP BY booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 1dd98deb5a..289c1f097a 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATETIME_TRUNC(bookings_source_src_28000.ds, day) = subq_2.ds GROUP BY booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index 5d73a84ade..343f194d98 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0.sql index 5f1622e075..6375387070 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0.sql index d85edd2ff1..87ccfed6cd 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index cff3ec569e..5cf61b70ac 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0.sql index b8c56f6459..48672d84f6 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0.sql index a35a9e8ff7..7d3bcb3d0c 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index cff3ec569e..5cf61b70ac 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0.sql index b8c56f6459..48672d84f6 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0.sql index a35a9e8ff7..7d3bcb3d0c 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index ae08128f5c..73a5ac4bc5 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0.sql index b616e773a1..6b9cde8390 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0.sql index 128b24b659..df8f5ba7fd 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index ae68147725..b563ac067a 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0.sql index 9f1d1a117f..c4487693ae 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0.sql index 050717ba0d..928d0395d5 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql index 41739a6c73..e059eb364b 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0.sql @@ -428,7 +428,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_0.metric_time__day = subq_4.ds + subq_3.metric_time__day = subq_4.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_5 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql index e627548003..f4cb2ff0cf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_joined_to_non_default_grain__plan0_optimized.sql @@ -13,7 +13,7 @@ CROSS JOIN LEFT OUTER JOIN ***************************.mf_time_spine subq_11 ON - subq_7.metric_time__day = subq_11.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_11.ds LEFT OUTER JOIN ***************************.mf_time_spine subq_12 ON diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0.sql index 487f21b190..e336d4958f 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0.sql @@ -50,7 +50,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_1 ON - subq_0.metric_time__day = subq_1.ds + subq_0.ds__day = subq_1.ds ) subq_2 GROUP BY subq_2.metric_time__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql index 6854133d20..cb56b24088 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.mf_time_spine time_spine_src_28006 LEFT OUTER JOIN ***************************.mf_time_spine subq_4 ON - subq_3.metric_time__day = subq_4.ds + DATE_TRUNC('day', time_spine_src_28006.ds) = subq_4.ds GROUP BY subq_4.martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0.sql index 137f4a913f..5df03967f5 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0.sql @@ -98,7 +98,7 @@ FROM ( LEFT OUTER JOIN ***************************.mf_time_spine subq_0 ON - bookings_source_src_28000.booking__ds__day = subq_0.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_0.ds ) subq_1 GROUP BY subq_1.booking__ds__martian_day diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql index 9988d2be35..d800e789e7 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_no_metric_custom_granularity_non_metric_time__plan0_optimized.sql @@ -7,6 +7,6 @@ FROM ***************************.fct_bookings bookings_source_src_28000 LEFT OUTER JOIN ***************************.mf_time_spine subq_2 ON - bookings_source_src_28000.booking__ds__day = subq_2.ds + DATE_TRUNC('day', bookings_source_src_28000.ds) = subq_2.ds GROUP BY subq_2.martian_day