diff --git a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py index 4324dc1190..e2a3c3db14 100644 --- a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py +++ b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py @@ -55,7 +55,6 @@ from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_from_plan_equal, assert_sql_plan_text_equal from metricflow.test.time.metric_time_dimension import MTD_SPEC_DAY -from metricflow.time.date_part import DatePart def convert_and_check( @@ -1011,89 +1010,6 @@ def test_compute_metrics_node_ratio_from_multiple_semantic_models( ) -@pytest.mark.sql_engine_snapshot -def test_simple_query_with_date_part( # noqa: D - request: FixtureRequest, - mf_test_session_state: MetricFlowTestSessionState, - dataflow_plan_builder: DataflowPlanBuilder, - dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - sql_client: SqlClient, -) -> None: - dataflow_plan = dataflow_plan_builder.build_plan( - MetricFlowQuerySpec( - metric_specs=(MetricSpec(element_name="bookings"),), - time_dimension_specs=( - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), - ), - ) - ) - - convert_and_check( - request=request, - mf_test_session_state=mf_test_session_state, - dataflow_to_sql_converter=dataflow_to_sql_converter, - sql_client=sql_client, - node=dataflow_plan.sink_output_nodes[0].parent_node, - ) - - -@pytest.mark.sql_engine_snapshot -def test_simple_query_with_multiple_date_parts( # noqa: D - request: FixtureRequest, - mf_test_session_state: MetricFlowTestSessionState, - dataflow_plan_builder: DataflowPlanBuilder, - dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - sql_client: SqlClient, -) -> None: - dataflow_plan = dataflow_plan_builder.build_plan( - MetricFlowQuerySpec( - metric_specs=(MetricSpec(element_name="bookings"),), - time_dimension_specs=( - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY), - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY), - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH), - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER), - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR), - ), - ) - ) - - convert_and_check( - request=request, - mf_test_session_state=mf_test_session_state, - dataflow_to_sql_converter=dataflow_to_sql_converter, - sql_client=sql_client, - node=dataflow_plan.sink_output_nodes[0].parent_node, - ) - - -@pytest.mark.sql_engine_snapshot -def test_offset_window_with_date_part( # noqa: D - request: FixtureRequest, - mf_test_session_state: MetricFlowTestSessionState, - dataflow_plan_builder: DataflowPlanBuilder, - dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, - sql_client: SqlClient, -) -> None: - dataflow_plan = dataflow_plan_builder.build_plan( - MetricFlowQuerySpec( - metric_specs=(MetricSpec(element_name="bookings_growth_2_weeks"),), - time_dimension_specs=( - DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), - ), - ) - ) - - convert_and_check( - request=request, - mf_test_session_state=mf_test_session_state, - dataflow_to_sql_converter=dataflow_to_sql_converter, - sql_client=sql_client, - node=dataflow_plan.sink_output_nodes[0].parent_node, - ) - - @pytest.mark.sql_engine_snapshot def test_simple_fill_nulls_with_0_metric_time( # noqa: D request: FixtureRequest, diff --git a/metricflow/test/query_rendering/test_granularity_date_part_rendering.py b/metricflow/test/query_rendering/test_granularity_date_part_rendering.py new file mode 100644 index 0000000000..548d33b088 --- /dev/null +++ b/metricflow/test/query_rendering/test_granularity_date_part_rendering.py @@ -0,0 +1,106 @@ +"""Tests metric query rendering for granularity and date part operations. + +This module runs query requests for various granularity/date part options and compares +the rendered output against snapshot files. +""" + +from __future__ import annotations + +import pytest +from _pytest.fixtures import FixtureRequest +from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity + +from metricflow.dataflow.builder.dataflow_plan_builder import DataflowPlanBuilder +from metricflow.dataset.dataset import DataSet +from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter +from metricflow.protocols.sql_client import SqlClient +from metricflow.specs.specs import ( + MetricFlowQuerySpec, + MetricSpec, +) +from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState +from metricflow.test.query_rendering.compare_rendered_query import convert_and_check +from metricflow.time.date_part import DatePart + + +@pytest.mark.sql_engine_snapshot +def test_simple_query_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +@pytest.mark.sql_engine_snapshot +def test_simple_query_with_multiple_date_parts( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +@pytest.mark.sql_engine_snapshot +def test_offset_window_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings_growth_2_weeks"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml deleted file mode 100644 index 92630d354a..0000000000 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml +++ /dev/null @@ -1,2037 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml deleted file mode 100644 index aea8e018ef..0000000000 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml +++ /dev/null @@ -1,811 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml deleted file mode 100644 index c4cc5618c4..0000000000 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml +++ /dev/null @@ -1,897 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql similarity index 100% rename from metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql rename to metricflow/test/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql