From 898c28276ca93145308f97dbeab23abf1b652fe2 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Fri, 26 Jul 2024 15:33:58 -0700 Subject: [PATCH 1/4] Use time spines to determine metric_time grain in no-metric queries --- .../model/semantics/linkable_spec_resolver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/metricflow-semantics/metricflow_semantics/model/semantics/linkable_spec_resolver.py b/metricflow-semantics/metricflow_semantics/model/semantics/linkable_spec_resolver.py index 7da7d635a5..00baa34b34 100644 --- a/metricflow-semantics/metricflow_semantics/model/semantics/linkable_spec_resolver.py +++ b/metricflow-semantics/metricflow_semantics/model/semantics/linkable_spec_resolver.py @@ -40,6 +40,7 @@ from metricflow_semantics.model.semantics.linkable_element_set import LinkableElementSet from metricflow_semantics.model.semantics.semantic_model_join_evaluator import SemanticModelJoinEvaluator from metricflow_semantics.specs.time_dimension_spec import DEFAULT_TIME_GRANULARITY +from metricflow_semantics.time.time_spine_source import TimeSpineSource if TYPE_CHECKING: from metricflow_semantics.model.semantics.semantic_model_lookup import SemanticModelLookup @@ -124,6 +125,7 @@ def __init__( # Sort semantic models by name for consistency in building derived objects. self._semantic_models = sorted(self._semantic_manifest.semantic_models, key=lambda x: x.name) self._join_evaluator = SemanticModelJoinEvaluator(semantic_model_lookup) + self._time_spine_sources = TimeSpineSource.create_from_manifest(self._semantic_manifest) assert max_entity_links >= 0 self._max_entity_links = max_entity_links @@ -464,7 +466,8 @@ def _get_metric_time_elements(self, measure_reference: Optional[MeasureReference time_dimension_reference=measure_agg_time_dimension_reference, ) else: - defined_granularity = DEFAULT_TIME_GRANULARITY + # If querying metric_time without metrics, will query from time spines. + defined_granularity = min(self._time_spine_sources.keys()) # It's possible to aggregate measures to coarser time granularities (except with cumulative metrics). possible_metric_time_granularities = tuple( From bf3cfe45eac6453287e2449efea9e39617f74903 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Fri, 26 Jul 2024 17:34:13 -0700 Subject: [PATCH 2/4] Add time spines for testing --- .../test_helpers/metric_time_dimension.py | 5 +++ .../shared/project_configuration.yaml | 37 ++++++++++++++++ .../test_matching_item_for_querying.py | 4 +- .../time_spine_table/mf_time_spine_hour.yaml | 42 +++++++++++++++++++ .../mf_time_spine_microsecond.yaml | 38 +++++++++++++++++ .../mf_time_spine_millisecond.yaml | 37 ++++++++++++++++ .../mf_time_spine_minute.yaml | 38 +++++++++++++++++ .../mf_time_spine_nanosecond.yaml | 36 ++++++++++++++++ .../mf_time_spine_second.yaml | 36 ++++++++++++++++ 9 files changed, 271 insertions(+), 2 deletions(-) create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_hour.yaml create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_microsecond.yaml create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_millisecond.yaml create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_minute.yaml create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_nanosecond.yaml create mode 100644 tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_second.yaml diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/metric_time_dimension.py b/metricflow-semantics/metricflow_semantics/test_helpers/metric_time_dimension.py index 090e5abd0e..1e85ad41c4 100644 --- a/metricflow-semantics/metricflow_semantics/test_helpers/metric_time_dimension.py +++ b/metricflow-semantics/metricflow_semantics/test_helpers/metric_time_dimension.py @@ -9,6 +9,11 @@ # Shortcuts for referring to the metric time dimension. MTD = MetricFlowReservedKeywords.METRIC_TIME.value MTD_REFERENCE = TimeDimensionReference(element_name=MetricFlowReservedKeywords.METRIC_TIME.value) +MTD_SPEC_NANOSECOND = TimeDimensionSpec( + element_name=MetricFlowReservedKeywords.METRIC_TIME.value, + entity_links=(), + time_granularity=TimeGranularity.NANOSECOND, +) MTD_SPEC_DAY = TimeDimensionSpec( element_name=MetricFlowReservedKeywords.METRIC_TIME.value, entity_links=(), time_granularity=TimeGranularity.DAY ) diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/shared/project_configuration.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/shared/project_configuration.yaml index 7ca0c2ae9f..56156ce0f0 100644 --- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/shared/project_configuration.yaml +++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/shared/project_configuration.yaml @@ -5,3 +5,40 @@ project_configuration: - location: $source_schema.mf_time_spine column_name: ds grain: day + time_spines: + - node_relation: + alias: mf_time_spine_nanosecond + schema_name: $source_schema + primary_column: + name: ts + time_granularity: nanosecond + - node_relation: + alias: mf_time_spine_microsecond + schema_name: $source_schema + primary_column: + name: ts + time_granularity: microsecond + - node_relation: + alias: mf_time_spine_millisecond + schema_name: $source_schema + primary_column: + name: ts + time_granularity: millisecond + - node_relation: + alias: mf_time_spine_second + schema_name: $source_schema + primary_column: + name: ts + time_granularity: second + - node_relation: + alias: mf_time_spine_minute + schema_name: $source_schema + primary_column: + name: ts + time_granularity: minute + - node_relation: + alias: mf_time_spine_hour + schema_name: $source_schema + primary_column: + name: ts + time_granularity: hour diff --git a/metricflow-semantics/tests_metricflow_semantics/query/group_by_item/test_matching_item_for_querying.py b/metricflow-semantics/tests_metricflow_semantics/query/group_by_item/test_matching_item_for_querying.py index 7b9aa5a429..7f6f9986bb 100644 --- a/metricflow-semantics/tests_metricflow_semantics/query/group_by_item/test_matching_item_for_querying.py +++ b/metricflow-semantics/tests_metricflow_semantics/query/group_by_item/test_matching_item_for_querying.py @@ -17,7 +17,7 @@ MetricGroupByItemResolutionNode, ) from metricflow_semantics.test_helpers.config_helpers import MetricFlowTestConfiguration -from metricflow_semantics.test_helpers.metric_time_dimension import MTD_SPEC_DAY, MTD_SPEC_MONTH, MTD_SPEC_YEAR +from metricflow_semantics.test_helpers.metric_time_dimension import MTD_SPEC_MONTH, MTD_SPEC_NANOSECOND, MTD_SPEC_YEAR from metricflow_semantics.test_helpers.snapshot_helpers import assert_object_snapshot_equal from tests_metricflow_semantics.query.group_by_item.conftest import AmbiguousResolutionQueryId @@ -46,7 +46,7 @@ def test_ambiguous_metric_time_in_query( # noqa: D103 ) if case_id is AmbiguousResolutionQueryId.NO_METRICS: - assert result.spec == MTD_SPEC_DAY + assert result.spec == MTD_SPEC_NANOSECOND elif case_id is AmbiguousResolutionQueryId.SIMPLE_METRIC: assert result.spec == MTD_SPEC_MONTH elif case_id is AmbiguousResolutionQueryId.METRICS_WITH_SAME_TIME_GRAINS: diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_hour.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_hour.yaml new file mode 100644 index 0000000000..f2d60ed567 --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_hour.yaml @@ -0,0 +1,42 @@ +table_snapshot: + table_name: mf_time_spine_hour + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 01:00:00"] + - ["2020-01-01 02:00:00"] + - ["2020-01-01 03:00:00"] + - ["2020-01-01 04:00:00"] + - ["2020-01-01 05:00:00"] + - ["2020-01-01 06:00:00"] + - ["2020-01-01 07:00:00"] + - ["2020-01-01 08:00:00"] + - ["2020-01-01 09:00:00"] + - ["2020-01-01 010:00:00"] + - ["2020-01-01 11:00:00"] + - ["2020-01-01 12:00:00"] + - ["2020-01-02 01:00:00"] + - ["2020-01-02 02:00:00"] + - ["2020-01-02 03:00:00"] + - ["2020-01-02 04:00:00"] + - ["2020-01-02 05:00:00"] + - ["2020-01-02 06:00:00"] + - ["2020-01-02 07:00:00"] + - ["2020-01-02 08:00:00"] + - ["2020-01-02 09:00:00"] + - ["2020-01-02 010:00:00"] + - ["2020-01-02 11:00:00"] + - ["2020-01-02 12:00:00"] + - ["2020-01-03 01:00:00"] + - ["2020-01-03 02:00:00"] + - ["2020-01-03 03:00:00"] + - ["2020-01-03 04:00:00"] + - ["2020-01-03 05:00:00"] + - ["2020-01-03 06:00:00"] + - ["2020-01-03 07:00:00"] + - ["2020-01-03 08:00:00"] + - ["2020-01-03 09:00:00"] + - ["2020-01-03 010:00:00"] + - ["2020-01-03 11:00:00"] + - ["2020-01-03 12:00:00"] \ No newline at end of file diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_microsecond.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_microsecond.yaml new file mode 100644 index 0000000000..cc45e443e7 --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_microsecond.yaml @@ -0,0 +1,38 @@ +table_snapshot: + table_name: mf_time_spine_microsecond + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 00:00:00.000000"] + - ["2020-01-01 00:00:00.000001"] + - ["2020-01-01 00:00:00.000002"] + - ["2020-01-01 00:00:00.000003"] + - ["2020-01-01 00:00:00.000004"] + - ["2020-01-01 00:00:00.000005"] + - ["2020-01-01 00:00:00.000006"] + - ["2020-01-01 00:00:00.000007"] + - ["2020-01-01 00:00:00.000008"] + - ["2020-01-01 00:00:00.000009"] + - ["2020-01-01 00:00:00.000010"] + - ["2020-01-01 00:00:00.000011"] + - ["2020-01-01 00:00:00.000012"] + - ["2020-01-01 00:00:00.000013"] + - ["2020-01-01 00:00:00.000014"] + - ["2020-01-01 00:00:00.000015"] + - ["2020-01-01 00:00:00.000016"] + - ["2020-01-01 00:00:00.000017"] + - ["2020-01-01 00:00:00.000018"] + - ["2020-01-01 00:00:00.000019"] + - ["2020-01-01 00:00:00.000020"] + - ["2020-01-01 00:00:00.000021"] + - ["2020-01-01 00:00:00.000022"] + - ["2020-01-01 00:00:00.000023"] + - ["2020-01-01 00:00:00.000024"] + - ["2020-01-01 00:00:00.000025"] + - ["2020-01-01 00:00:00.000026"] + - ["2020-01-01 00:00:00.000027"] + - ["2020-01-01 00:00:00.000028"] + - ["2020-01-01 00:00:00.000029"] + - ["2020-01-01 00:00:00.000030"] + \ No newline at end of file diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_millisecond.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_millisecond.yaml new file mode 100644 index 0000000000..4e480adeca --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_millisecond.yaml @@ -0,0 +1,37 @@ +table_snapshot: + table_name: mf_time_spine_millisecond + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 00:00:00.001"] + - ["2020-01-01 00:00:00.002"] + - ["2020-01-01 00:00:00.003"] + - ["2020-01-01 00:00:00.004"] + - ["2020-01-01 00:00:00.005"] + - ["2020-01-01 00:00:00.006"] + - ["2020-01-01 00:00:00.007"] + - ["2020-01-01 00:00:00.008"] + - ["2020-01-01 00:00:00.009"] + - ["2020-01-01 00:00:00.010"] + - ["2020-01-01 00:00:00.011"] + - ["2020-01-01 00:00:00.012"] + - ["2020-01-01 00:00:00.013"] + - ["2020-01-01 00:00:00.014"] + - ["2020-01-01 00:00:00.015"] + - ["2020-01-01 00:00:00.016"] + - ["2020-01-01 00:00:00.017"] + - ["2020-01-01 00:00:00.018"] + - ["2020-01-01 00:00:00.019"] + - ["2020-01-01 00:00:00.020"] + - ["2020-01-01 00:00:00.021"] + - ["2020-01-01 00:00:00.022"] + - ["2020-01-01 00:00:00.023"] + - ["2020-01-01 00:00:00.024"] + - ["2020-01-01 00:00:00.025"] + - ["2020-01-01 00:00:00.026"] + - ["2020-01-01 00:00:00.027"] + - ["2020-01-01 00:00:00.028"] + - ["2020-01-01 00:00:00.029"] + - ["2020-01-01 00:00:00.030"] + \ No newline at end of file diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_minute.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_minute.yaml new file mode 100644 index 0000000000..834f4377e1 --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_minute.yaml @@ -0,0 +1,38 @@ +table_snapshot: + table_name: mf_time_spine_minute + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 00:00:00"] + - ["2020-01-01 00:01:00"] + - ["2020-01-01 00:02:00"] + - ["2020-01-01 00:03:00"] + - ["2020-01-01 00:04:00"] + - ["2020-01-01 00:05:00"] + - ["2020-01-01 00:06:00"] + - ["2020-01-01 00:07:00"] + - ["2020-01-01 00:08:00"] + - ["2020-01-01 00:09:00"] + - ["2020-01-01 00:10:00"] + - ["2020-01-01 00:11:00"] + - ["2020-01-01 00:12:00"] + - ["2020-01-01 00:13:00"] + - ["2020-01-01 00:14:00"] + - ["2020-01-01 00:15:00"] + - ["2020-01-01 00:16:00"] + - ["2020-01-01 00:17:00"] + - ["2020-01-01 00:18:00"] + - ["2020-01-01 00:19:00"] + - ["2020-01-01 00:20:00"] + - ["2020-01-01 00:21:00"] + - ["2020-01-01 00:22:00"] + - ["2020-01-01 00:23:00"] + - ["2020-01-01 00:24:00"] + - ["2020-01-01 00:25:00"] + - ["2020-01-01 00:26:00"] + - ["2020-01-01 00:27:00"] + - ["2020-01-01 00:28:00"] + - ["2020-01-01 00:29:00"] + - ["2020-01-01 00:30:00"] + \ No newline at end of file diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_nanosecond.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_nanosecond.yaml new file mode 100644 index 0000000000..e63ddd16ad --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_nanosecond.yaml @@ -0,0 +1,36 @@ +table_snapshot: + table_name: mf_time_spine_nanosecond + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 00:00:00.000000001"] + - ["2020-01-01 00:00:00.000000002"] + - ["2020-01-01 00:00:00.000000003"] + - ["2020-01-01 00:00:00.000000004"] + - ["2020-01-01 00:00:00.000000005"] + - ["2020-01-01 00:00:00.000000006"] + - ["2020-01-01 00:00:00.000000007"] + - ["2020-01-01 00:00:00.000000008"] + - ["2020-01-01 00:00:00.000000009"] + - ["2020-01-01 00:00:00.000000010"] + - ["2020-01-01 00:00:00.000000011"] + - ["2020-01-01 00:00:00.000000012"] + - ["2020-01-01 00:00:00.000000013"] + - ["2020-01-01 00:00:00.000000014"] + - ["2020-01-01 00:00:00.000000015"] + - ["2020-01-01 00:00:00.000000016"] + - ["2020-01-01 00:00:00.000000017"] + - ["2020-01-01 00:00:00.000000018"] + - ["2020-01-01 00:00:00.000000019"] + - ["2020-01-01 00:00:00.000000020"] + - ["2020-01-01 00:00:00.000000021"] + - ["2020-01-01 00:00:00.000000022"] + - ["2020-01-01 00:00:00.000000023"] + - ["2020-01-01 00:00:00.000000024"] + - ["2020-01-01 00:00:00.000000025"] + - ["2020-01-01 00:00:00.000000026"] + - ["2020-01-01 00:00:00.000000027"] + - ["2020-01-01 00:00:00.000000028"] + - ["2020-01-01 00:00:00.000000029"] + - ["2020-01-01 00:00:00.000000030"] diff --git a/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_second.yaml b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_second.yaml new file mode 100644 index 0000000000..5d1d193481 --- /dev/null +++ b/tests_metricflow/fixtures/source_table_snapshots/time_spine_table/mf_time_spine_second.yaml @@ -0,0 +1,36 @@ +table_snapshot: + table_name: mf_time_spine_second + column_definitions: + - name: ts + type: TIME + rows: + - ["2020-01-01 00:00:01"] + - ["2020-01-01 00:00:02"] + - ["2020-01-01 00:00:03"] + - ["2020-01-01 00:00:04"] + - ["2020-01-01 00:00:05"] + - ["2020-01-01 00:00:06"] + - ["2020-01-01 00:00:07"] + - ["2020-01-01 00:00:08"] + - ["2020-01-01 00:00:09"] + - ["2020-01-01 00:00:10"] + - ["2020-01-01 00:00:11"] + - ["2020-01-01 00:00:12"] + - ["2020-01-01 00:00:13"] + - ["2020-01-01 00:00:14"] + - ["2020-01-01 00:00:15"] + - ["2020-01-01 00:00:16"] + - ["2020-01-01 00:00:17"] + - ["2020-01-01 00:00:18"] + - ["2020-01-01 00:00:19"] + - ["2020-01-01 00:00:20"] + - ["2020-01-01 00:00:21"] + - ["2020-01-01 00:00:22"] + - ["2020-01-01 00:00:23"] + - ["2020-01-01 00:00:24"] + - ["2020-01-01 00:00:25"] + - ["2020-01-01 00:00:26"] + - ["2020-01-01 00:00:27"] + - ["2020-01-01 00:00:28"] + - ["2020-01-01 00:00:29"] + - ["2020-01-01 00:00:30"] From 088c68bec27392269ecc96ec1e75aee04027da35 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Fri, 26 Jul 2024 17:40:29 -0700 Subject: [PATCH 3/4] Update snapshots --- .../specs/time_dimension_spec.py | 3 -- ...lable_group_by_items__no_metrics__set0.txt | 42 +++++++++++++++++++ ...me_in_query_filter__no_metrics__result.txt | 6 +-- ...elements_for_no_metrics_query__result0.txt | 2 +- .../DataflowPlan/test_cyclic_join__dfp_0.xml | 6 +-- .../test_common_semantic_model__dfp_0.xml | 16 +++---- ...indow_or_grain_with_metric_time__dfp_0.xml | 4 +- ...ow_or_grain_without_metric_time__dfp_0.xml | 4 +- ...e_metric_with_non_default_grain__dfp_0.xml | 4 +- ...t_cumulative_metric_with_window__dfp_0.xml | 4 +- ...e_metric_with_non_default_grain__dfp_0.xml | 4 +- ..._derived_metric_offset_to_grain__dfp_0.xml | 8 ++-- ...st_derived_metric_offset_window__dfp_0.xml | 4 +- ..._metric_offset_with_granularity__dfp_0.xml | 4 +- ...erived_offset_cumulative_metric__dfp_0.xml | 4 +- ...dimensions_with_time_constraint__dfp_0.xml | 6 +-- .../test_distinct_values_plan__dfp_0.xml | 2 +- ..._distinct_values_plan_with_join__dfp_0.xml | 4 +- ..._if_no_time_dimension_requested__dfp_0.xml | 4 +- ...in_to_time_spine_derived_metric__dfp_0.xml | 8 ++-- ...join_to_time_spine_with_filters__dfp_0.xml | 4 +- ..._to_time_spine_with_metric_time__dfp_0.xml | 4 +- ...time_spine_with_non_metric_time__dfp_0.xml | 4 +- .../DataflowPlan/test_joined_plan__dfp_0.xml | 8 ++-- .../test_limit_rows_plan__dfp_0.xml | 4 +- .../test_measure_constraint_plan__dfp_0.xml | 20 ++++----- ...traint_with_reused_measure_plan__dfp_0.xml | 8 ++-- ...t_metric_in_metric_where_filter__dfp_0.xml | 8 ++-- ...st_metric_in_query_where_filter__dfp_0.xml | 8 ++-- .../test_metric_time_only__dfp_0.xml | 4 +- .../test_metric_time_quarter__dfp_0.xml | 4 +- ...tric_time_with_other_dimensions__dfp_0.xml | 8 ++-- .../test_min_max_metric_time__dfp_0.xml | 4 +- .../test_min_max_metric_time_week__dfp_0.xml | 4 +- .../test_min_max_only_categorical__dfp_0.xml | 2 +- .../test_min_max_only_time__dfp_0.xml | 2 +- .../test_min_max_only_time_year__dfp_0.xml | 2 +- ...mantic_model_ratio_metrics_plan__dfp_0.xml | 16 +++---- .../test_multihop_join_plan__dfp_0.xml | 12 +++--- .../test_multiple_metrics_plan__dfp_0.xml | 8 ++-- ...erived_metric_with_outer_offset__dfp_0.xml | 4 +- ...ry_have_different_granularities__dfp_0.xml | 4 +- ...ry_have_different_granularities__dfp_0.xml | 8 ++-- .../test_order_by_plan__dfp_0.xml | 4 +- .../test_primary_entity_dimension__dfp_0.xml | 4 +- .../DataflowPlan/test_simple_plan__dfp_0.xml | 4 +- ...mantic_model_ratio_metrics_plan__dfp_0.xml | 16 +++---- .../test_where_constrained_plan__dfp_0.xml | 8 ++-- ...constrained_plan_time_dimension__dfp_0.xml | 4 +- ...ained_with_common_linkable_plan__dfp_0.xml | 8 ++-- ...dimensions_with_time_constraint__plan0.sql | 24 +++++------ ..._with_time_constraint__plan0_optimized.sql | 8 ++-- .../DuckDB/test_metric_time_only__plan0.sql | 24 +++++------ ...test_metric_time_only__plan0_optimized.sql | 2 +- .../test_metric_time_quarter_alone__plan0.sql | 24 +++++------ ...ic_time_quarter_alone__plan0_optimized.sql | 2 +- ...tric_time_with_other_dimensions__plan0.sql | 24 +++++------ ...with_other_dimensions__plan0_optimized.sql | 6 +-- ...dimensions_with_time_constraint__plan0.xml | 30 ++++++------- .../test_metric_time_only__plan0.xml | 30 ++++++------- .../test_metric_time_quarter_alone__plan0.xml | 30 ++++++------- ...tric_time_with_other_dimensions__plan0.xml | 30 ++++++------- ...rsion_metric_predicate_pushdown__dfp_0.xml | 18 ++++---- ...ative_metric_predicate_pushdown__dfp_0.xml | 8 ++-- ...spine_metric_predicate_pushdown__dfp_0.xml | 16 +++---- ...ost_agg_join_predicate_pushdown__dfp_0.xml | 16 +++---- ...ffset_metric_predicate_pushdown__dfp_0.xml | 16 +++---- ...imple_join_categorical_pushdown__dfp_0.xml | 8 ++-- ..._time_pushdown_with_two_targets__dfp_0.xml | 8 ++-- .../test_min_max_metric_time__plan0.sql | 24 +++++------ ...t_min_max_metric_time__plan0_optimized.sql | 2 +- .../test_min_max_metric_time_week__plan0.sql | 24 +++++------ ..._max_metric_time_week__plan0_optimized.sql | 2 +- ...2_metrics_from_1_semantic_model__dfp_0.xml | 16 +++---- ..._metrics_from_2_semantic_models__dfp_0.xml | 8 ++-- ...o_metrics_from_1_semantic_model__dfp_0.xml | 16 +++---- ..._metrics_from_2_semantic_models__dfp_0.xml | 12 +++--- ...constrained_metric_not_combined__dfp_0.xml | 8 ++-- .../test_derived_metric__dfp_0.xml | 8 ++-- ..._metric_with_non_derived_metric__dfp_0.xml | 12 +++--- .../test_duplicate_measures__dfp_0.xml | 8 ++-- .../test_nested_derived_metric__dfp_0.xml | 16 +++---- 82 files changed, 428 insertions(+), 389 deletions(-) diff --git a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py index 6f47e161c1..4f7a844d5d 100644 --- a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py +++ b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py @@ -203,6 +203,3 @@ def generate_possible_specs_for_time_dimension( @property def is_metric_time(self) -> bool: # noqa: D102 return self.element_name == METRIC_TIME_ELEMENT_NAME - - -DEFAULT_TIME_GRANULARITY = TimeGranularity.DAY diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_available_group_by_items.py/LinkableSpecSet/test_available_group_by_items__no_metrics__set0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_available_group_by_items.py/LinkableSpecSet/test_available_group_by_items__no_metrics__set0.txt index 3f3066a685..81ebfcea27 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_available_group_by_items.py/LinkableSpecSet/test_available_group_by_items__no_metrics__set0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_available_group_by_items.py/LinkableSpecSet/test_available_group_by_items__no_metrics__set0.txt @@ -6,13 +6,55 @@ "TimeDimension('metric_time', 'day', date_part_name='month')", "TimeDimension('metric_time', 'day', date_part_name='quarter')", "TimeDimension('metric_time', 'day', date_part_name='year')", + "TimeDimension('metric_time', 'hour')", + "TimeDimension('metric_time', 'hour', date_part_name='day')", + "TimeDimension('metric_time', 'hour', date_part_name='dow')", + "TimeDimension('metric_time', 'hour', date_part_name='doy')", + "TimeDimension('metric_time', 'hour', date_part_name='month')", + "TimeDimension('metric_time', 'hour', date_part_name='quarter')", + "TimeDimension('metric_time', 'hour', date_part_name='year')", + "TimeDimension('metric_time', 'microsecond')", + "TimeDimension('metric_time', 'microsecond', date_part_name='day')", + "TimeDimension('metric_time', 'microsecond', date_part_name='dow')", + "TimeDimension('metric_time', 'microsecond', date_part_name='doy')", + "TimeDimension('metric_time', 'microsecond', date_part_name='month')", + "TimeDimension('metric_time', 'microsecond', date_part_name='quarter')", + "TimeDimension('metric_time', 'microsecond', date_part_name='year')", + "TimeDimension('metric_time', 'millisecond')", + "TimeDimension('metric_time', 'millisecond', date_part_name='day')", + "TimeDimension('metric_time', 'millisecond', date_part_name='dow')", + "TimeDimension('metric_time', 'millisecond', date_part_name='doy')", + "TimeDimension('metric_time', 'millisecond', date_part_name='month')", + "TimeDimension('metric_time', 'millisecond', date_part_name='quarter')", + "TimeDimension('metric_time', 'millisecond', date_part_name='year')", + "TimeDimension('metric_time', 'minute')", + "TimeDimension('metric_time', 'minute', date_part_name='day')", + "TimeDimension('metric_time', 'minute', date_part_name='dow')", + "TimeDimension('metric_time', 'minute', date_part_name='doy')", + "TimeDimension('metric_time', 'minute', date_part_name='month')", + "TimeDimension('metric_time', 'minute', date_part_name='quarter')", + "TimeDimension('metric_time', 'minute', date_part_name='year')", "TimeDimension('metric_time', 'month')", "TimeDimension('metric_time', 'month', date_part_name='month')", "TimeDimension('metric_time', 'month', date_part_name='quarter')", "TimeDimension('metric_time', 'month', date_part_name='year')", + "TimeDimension('metric_time', 'nanosecond')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='day')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='dow')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='doy')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='month')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='quarter')", + "TimeDimension('metric_time', 'nanosecond', date_part_name='year')", "TimeDimension('metric_time', 'quarter')", "TimeDimension('metric_time', 'quarter', date_part_name='quarter')", "TimeDimension('metric_time', 'quarter', date_part_name='year')", + "TimeDimension('metric_time', 'second')", + "TimeDimension('metric_time', 'second', date_part_name='day')", + "TimeDimension('metric_time', 'second', date_part_name='dow')", + "TimeDimension('metric_time', 'second', date_part_name='doy')", + "TimeDimension('metric_time', 'second', date_part_name='month')", + "TimeDimension('metric_time', 'second', date_part_name='quarter')", + "TimeDimension('metric_time', 'second', date_part_name='year')", "TimeDimension('metric_time', 'week')", "TimeDimension('metric_time', 'week', date_part_name='month')", "TimeDimension('metric_time', 'week', date_part_name='quarter')", diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_matching_item_for_filters.py/GroupByItemResolution/test_ambiguous_metric_time_in_query_filter__no_metrics__result.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_matching_item_for_filters.py/GroupByItemResolution/test_ambiguous_metric_time_in_query_filter__no_metrics__result.txt index ac202ecaf3..4bde0d590e 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_matching_item_for_filters.py/GroupByItemResolution/test_ambiguous_metric_time_in_query_filter__no_metrics__result.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_matching_item_for_filters.py/GroupByItemResolution/test_ambiguous_metric_time_in_query_filter__no_metrics__result.txt @@ -1,11 +1,11 @@ GroupByItemResolution( - spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY), + spec=TimeDimensionSpec(element_name='metric_time', time_granularity=NANOSECOND), linkable_element_set=LinkableElementSet( path_key_to_linkable_dimensions={ ElementPathKey( element_name='metric_time', element_type=TIME_DIMENSION, - time_granularity=DAY, + time_granularity=NANOSECOND, ): ( LinkableDimension( properties=(METRIC_TIME,), @@ -16,7 +16,7 @@ GroupByItemResolution( semantic_model_name='__VIRTUAL__', ), ), - time_granularity=DAY, + time_granularity=NANOSECOND, ), ), }, diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt index 7cf20ab18e..3ad935edbb 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt @@ -435,7 +435,7 @@ 'lux_listing__listing__lux_listing__twice_bookings_fill_nulls_with_0_without_time_spine', 'lux_listing__listing__lux_listing__views', 'lux_listing__listing__lux_listing__views_times_booking_value', - 'metric_time__day', + 'metric_time__nanosecond', 'revenue_instance__ds__day', 'revenue_instance__ds__extract_day', 'revenue_instance__ds__extract_dow', diff --git a/tests_metricflow/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml b/tests_metricflow/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml index e913b52a4b..ae541e136e 100644 --- a/tests_metricflow/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml +++ b/tests_metricflow/snapshots/test_cyclic_join.py/DataflowPlan/test_cyclic_join__dfp_0.xml @@ -36,11 +36,11 @@ - + - + @@ -53,7 +53,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml index 0fe093d825..fef8f21032 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_common_semantic_model__dfp_0.xml @@ -42,11 +42,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -110,11 +110,11 @@ - + - + @@ -127,11 +127,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml index 914569e512..bf54d2fce4 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_with_metric_time__dfp_0.xml @@ -22,11 +22,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml index 33f9fc76f8..0db2f56fd7 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_no_window_or_grain_without_metric_time__dfp_0.xml @@ -16,11 +16,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_non_default_grain__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_non_default_grain__dfp_0.xml index 4352536fd0..67442fc6af 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_non_default_grain__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_non_default_grain__dfp_0.xml @@ -34,11 +34,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml index 1283d92943..244821dae7 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_cumulative_metric_with_window__dfp_0.xml @@ -23,11 +23,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_cumulative_metric_with_non_default_grain__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_cumulative_metric_with_non_default_grain__dfp_0.xml index e7e2471f97..bdae25ff6b 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_cumulative_metric_with_non_default_grain__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_cumulative_metric_with_non_default_grain__dfp_0.xml @@ -38,11 +38,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml index bc7da98f3e..1e6217f25c 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_to_grain__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -61,11 +61,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml index b7b0209d66..f1a363e216 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_window__dfp_0.xml @@ -36,11 +36,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml index d9ca9b4480..91f4aac2d3 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_metric_offset_with_granularity__dfp_0.xml @@ -36,11 +36,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml index 30aa24a5f4..67373508a6 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_derived_offset_cumulative_metric__dfp_0.xml @@ -42,11 +42,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml index 415f19bcf2..18a280f887 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dimensions_with_time_constraint__dfp_0.xml @@ -21,7 +21,7 @@ - + @@ -31,11 +31,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml index 4096dc93bd..1e8196b582 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan__dfp_0.xml @@ -67,7 +67,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml index 90f3ed7004..8ca7a32b85 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_distinct_values_plan_with_join__dfp_0.xml @@ -81,7 +81,7 @@ - + @@ -92,7 +92,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml index ca3d0e8227..7760e7b9c3 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_dont_join_to_time_spine_if_no_time_dimension_requested__dfp_0.xml @@ -16,11 +16,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml index b0302f1ac3..3ecf955c35 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_derived_metric__dfp_0.xml @@ -34,11 +34,11 @@ - + - + @@ -86,11 +86,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_filters__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_filters__dfp_0.xml index 621594973f..668ed3edad 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_filters__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_filters__dfp_0.xml @@ -147,11 +147,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml index 7cab7e01e1..8894c05413 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_metric_time__dfp_0.xml @@ -27,11 +27,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml index 5b498724ca..e176f164e6 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_join_to_time_spine_with_non_metric_time__dfp_0.xml @@ -22,11 +22,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml index 227386e31b..dd95dca8e0 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_joined_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml index e0db8bfde2..58fe24e376 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_limit_rows_plan__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml index 8aaf8772a7..01ef085957 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_plan__dfp_0.xml @@ -162,12 +162,12 @@ - + - + @@ -180,12 +180,12 @@ - + - + @@ -348,12 +348,12 @@ - + - + @@ -366,12 +366,12 @@ - + - + @@ -397,11 +397,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml index 94c67d5965..e186ee1481 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_measure_constraint_with_reused_measure_plan__dfp_0.xml @@ -124,11 +124,11 @@ - + - + @@ -152,11 +152,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_metric_where_filter__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_metric_where_filter__dfp_0.xml index 010e620781..355d69e546 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_metric_where_filter__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_metric_where_filter__dfp_0.xml @@ -67,11 +67,11 @@ - + - + @@ -102,12 +102,12 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_query_where_filter__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_query_where_filter__dfp_0.xml index b0a31a473c..26a64602d6 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_query_where_filter__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_in_query_where_filter__dfp_0.xml @@ -93,11 +93,11 @@ - + - + @@ -128,12 +128,12 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml index 66cab34841..0d0b8c95fe 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_only__dfp_0.xml @@ -9,11 +9,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml index 8681109851..a7ec17768a 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_quarter__dfp_0.xml @@ -9,11 +9,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml index d57c92a51c..c98504cdc4 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_time_with_other_dimensions__dfp_0.xml @@ -27,7 +27,7 @@ - + @@ -38,11 +38,11 @@ - + - + @@ -55,7 +55,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time__dfp_0.xml index 72b29b2006..527a7bd36b 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time__dfp_0.xml @@ -12,11 +12,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time_week__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time_week__dfp_0.xml index 5a86800a4e..61fd7ad0b7 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time_week__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_metric_time_week__dfp_0.xml @@ -12,11 +12,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml index 86684220f1..5886aada0e 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_categorical__dfp_0.xml @@ -16,7 +16,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml index 758d3d0c59..16301f285f 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time__dfp_0.xml @@ -17,7 +17,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml index 724432836d..7f4200ead4 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_min_max_only_time_year__dfp_0.xml @@ -17,7 +17,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml index b29c93a7e8..4f2fe013fa 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + @@ -115,11 +115,11 @@ - + - + @@ -132,11 +132,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml index f53e7c0ce1..25d62e8faa 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml @@ -52,11 +52,11 @@ - + - + @@ -97,11 +97,11 @@ - + - + @@ -328,11 +328,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml index d2867a667f..439a216e2e 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multiple_metrics_plan__dfp_0.xml @@ -25,11 +25,11 @@ - + - + @@ -57,11 +57,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml index 83552ed2f4..278978a74c 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_nested_derived_metric_with_outer_offset__dfp_0.xml @@ -53,11 +53,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_to_grain_metric_filter_and_query_have_different_granularities__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_to_grain_metric_filter_and_query_have_different_granularities__dfp_0.xml index ba790537f8..22af651f78 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_to_grain_metric_filter_and_query_have_different_granularities__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_to_grain_metric_filter_and_query_have_different_granularities__dfp_0.xml @@ -146,11 +146,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_window_metric_filter_and_query_have_different_granularities__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_window_metric_filter_and_query_have_different_granularities__dfp_0.xml index f013299c7a..0d99a4a2e3 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_window_metric_filter_and_query_have_different_granularities__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_offset_window_metric_filter_and_query_have_different_granularities__dfp_0.xml @@ -150,11 +150,11 @@ - + - + @@ -258,11 +258,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml index 7ba932194b..3354f7bf20 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_order_by_plan__dfp_0.xml @@ -27,11 +27,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml index cf479cd665..39c81616f4 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_primary_entity_dimension__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml index cf479cd665..39c81616f4 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_simple_plan__dfp_0.xml @@ -21,11 +21,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml index 959067757b..61675b49ee 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_single_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -47,11 +47,11 @@ - + - + @@ -64,11 +64,11 @@ - + - + @@ -115,11 +115,11 @@ - + - + @@ -132,11 +132,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml index 6478d60801..55109326af 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan__dfp_0.xml @@ -163,11 +163,11 @@ - + - + @@ -180,11 +180,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml index 4fe0d5461f..4226540ce0 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_plan_time_dimension__dfp_0.xml @@ -102,11 +102,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml index 7109d76f6d..4c900a8ec5 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_where_constrained_with_common_linkable_plan__dfp_0.xml @@ -141,11 +141,11 @@ - + - + @@ -158,11 +158,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql index 1e42a5d726..4fa1768bc7 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql @@ -218,18 +218,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_1 ) subq_2 ) subq_3 diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql index 96a96bb787..f7f473a317 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0_optimized.sql @@ -2,18 +2,18 @@ -- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-03T00:00:00] -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS metric_time__day + DATE_TRUNC('day', time_spine_src_28006.ds) AS metric_time__day , listings_latest_src_28000.is_lux AS listing__is_lux_latest , users_latest_src_28000.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 CROSS JOIN - ***************************.mf_time_spine time_spine_src_28000 + ***************************.mf_time_spine time_spine_src_28006 FULL OUTER JOIN ***************************.dim_users_latest users_latest_src_28000 ON listings_latest_src_28000.user_id = users_latest_src_28000.user_id -WHERE DATE_TRUNC('day', time_spine_src_28000.ds) BETWEEN '2020-01-01' AND '2020-01-03' +WHERE DATE_TRUNC('day', time_spine_src_28006.ds) BETWEEN '2020-01-01' AND '2020-01-03' GROUP BY - DATE_TRUNC('day', time_spine_src_28000.ds) + DATE_TRUNC('day', time_spine_src_28006.ds) , listings_latest_src_28000.is_lux , users_latest_src_28000.home_state_latest diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql index c6bb4bb18f..b7efe020e7 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_0 ) subq_1 GROUP BY diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql index 2eed8d0c4b..ec27d0d54a 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_only__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day -FROM ***************************.mf_time_spine time_spine_src_28000 +FROM ***************************.mf_time_spine time_spine_src_28006 GROUP BY DATE_TRUNC('day', ds) diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql index a1584ad35b..a719a46832 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0.sql @@ -29,18 +29,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_0 ) subq_1 GROUP BY diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql index 89d1d3d730..d33ecb7c33 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_quarter_alone__plan0_optimized.sql @@ -3,6 +3,6 @@ -- Pass Only Elements: ['metric_time__quarter',] SELECT DATE_TRUNC('quarter', ds) AS metric_time__quarter -FROM ***************************.mf_time_spine time_spine_src_28000 +FROM ***************************.mf_time_spine time_spine_src_28006 GROUP BY DATE_TRUNC('quarter', ds) diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql index 44f88a1efd..0ca186e4af 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql @@ -157,18 +157,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_1 ) subq_2 ) subq_3 diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql index f029b6173e..68e7b122d2 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0_optimized.sql @@ -1,17 +1,17 @@ -- Join Standard Outputs -- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest', 'metric_time__day'] SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS metric_time__day + DATE_TRUNC('day', time_spine_src_28006.ds) AS metric_time__day , listings_latest_src_28000.is_lux AS listing__is_lux_latest , users_latest_src_28000.home_state_latest AS user__home_state_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 CROSS JOIN - ***************************.mf_time_spine time_spine_src_28000 + ***************************.mf_time_spine time_spine_src_28006 FULL OUTER JOIN ***************************.dim_users_latest users_latest_src_28000 ON listings_latest_src_28000.user_id = users_latest_src_28000.user_id GROUP BY - DATE_TRUNC('day', time_spine_src_28000.ds) + DATE_TRUNC('day', time_spine_src_28006.ds) , listings_latest_src_28000.is_lux , users_latest_src_28000.home_state_latest diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml index e81db14dc9..97316b5987 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml @@ -784,64 +784,64 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml index ab92d8b32b..8015a84cec 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_only__plan0.xml @@ -66,33 +66,33 @@ - + - - - - - - + + + + + + - + - + - - - + + + - - + + - + diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml index 9bc2e28999..f098163cf6 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_quarter_alone__plan0.xml @@ -67,33 +67,33 @@ - + - - - - - - + + + + + + - + - + - - - + + + - - + + - + diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml index 30066f15a8..985ec9303d 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml @@ -533,58 +533,58 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml index f819a44912..63b4cfcd0a 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml @@ -153,11 +153,11 @@ - + - + @@ -170,7 +170,7 @@ - + @@ -257,11 +257,11 @@ - + - + @@ -273,7 +273,7 @@ - + @@ -284,11 +284,11 @@ - + - + @@ -303,7 +303,7 @@ - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_cumulative_metric_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_cumulative_metric_predicate_pushdown__dfp_0.xml index 18ed3d0c5c..3fd12a5735 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_cumulative_metric_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_cumulative_metric_predicate_pushdown__dfp_0.xml @@ -155,11 +155,11 @@ - + - + @@ -173,11 +173,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_predicate_pushdown__dfp_0.xml index b916d545c0..05e5480fbe 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_predicate_pushdown__dfp_0.xml @@ -211,12 +211,12 @@ - + - + @@ -229,12 +229,12 @@ - + - + @@ -423,12 +423,12 @@ - + - + @@ -442,12 +442,12 @@ - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_with_post_agg_join_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_with_post_agg_join_predicate_pushdown__dfp_0.xml index 3e0f6ba307..f6f53d7377 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_with_post_agg_join_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_fill_nulls_time_spine_metric_with_post_agg_join_predicate_pushdown__dfp_0.xml @@ -242,12 +242,12 @@ - + - + @@ -260,12 +260,12 @@ - + - + @@ -485,12 +485,12 @@ - + - + @@ -504,12 +504,12 @@ - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_offset_metric_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_offset_metric_predicate_pushdown__dfp_0.xml index 9059fcb7e2..512cdc0fce 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_offset_metric_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_offset_metric_predicate_pushdown__dfp_0.xml @@ -201,12 +201,12 @@ - + - + @@ -219,12 +219,12 @@ - + - + @@ -401,12 +401,12 @@ - + - + @@ -420,12 +420,12 @@ - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_categorical_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_categorical_pushdown__dfp_0.xml index 7f2c90a551..80357bff35 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_categorical_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_categorical_pushdown__dfp_0.xml @@ -143,11 +143,11 @@ - + - + @@ -160,11 +160,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_metric_time_pushdown_with_two_targets__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_metric_time_pushdown_with_two_targets__dfp_0.xml index 20bfbfe40f..621a7a9449 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_metric_time_pushdown_with_two_targets__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_simple_join_metric_time_pushdown_with_two_targets__dfp_0.xml @@ -119,11 +119,11 @@ - + - + @@ -136,11 +136,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0.sql index fecf550869..0eef091ea3 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0.sql @@ -34,18 +34,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_0 ) subq_1 GROUP BY diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0_optimized.sql index ce2a27035e..4d31ef04b9 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Pass Only Elements: ['metric_time__day',] SELECT DATE_TRUNC('day', ds) AS metric_time__day - FROM ***************************.mf_time_spine time_spine_src_28000 + FROM ***************************.mf_time_spine time_spine_src_28006 GROUP BY DATE_TRUNC('day', ds) ) subq_5 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0.sql index 8216c96cc1..7c587e39ac 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0.sql @@ -34,18 +34,18 @@ FROM ( FROM ( -- Time Spine SELECT - DATE_TRUNC('day', time_spine_src_28000.ds) AS ds__day - , DATE_TRUNC('week', time_spine_src_28000.ds) AS ds__week - , DATE_TRUNC('month', time_spine_src_28000.ds) AS ds__month - , DATE_TRUNC('quarter', time_spine_src_28000.ds) AS ds__quarter - , DATE_TRUNC('year', time_spine_src_28000.ds) AS ds__year - , EXTRACT(year FROM time_spine_src_28000.ds) AS ds__extract_year - , EXTRACT(quarter FROM time_spine_src_28000.ds) AS ds__extract_quarter - , EXTRACT(month FROM time_spine_src_28000.ds) AS ds__extract_month - , EXTRACT(day FROM time_spine_src_28000.ds) AS ds__extract_day - , EXTRACT(isodow FROM time_spine_src_28000.ds) AS ds__extract_dow - , EXTRACT(doy FROM time_spine_src_28000.ds) AS ds__extract_doy - FROM ***************************.mf_time_spine time_spine_src_28000 + DATE_TRUNC('day', time_spine_src_28006.ds) AS ds__day + , DATE_TRUNC('week', time_spine_src_28006.ds) AS ds__week + , DATE_TRUNC('month', time_spine_src_28006.ds) AS ds__month + , DATE_TRUNC('quarter', time_spine_src_28006.ds) AS ds__quarter + , DATE_TRUNC('year', time_spine_src_28006.ds) AS ds__year + , EXTRACT(year FROM time_spine_src_28006.ds) AS ds__extract_year + , EXTRACT(quarter FROM time_spine_src_28006.ds) AS ds__extract_quarter + , EXTRACT(month FROM time_spine_src_28006.ds) AS ds__extract_month + , EXTRACT(day FROM time_spine_src_28006.ds) AS ds__extract_day + , EXTRACT(isodow FROM time_spine_src_28006.ds) AS ds__extract_dow + , EXTRACT(doy FROM time_spine_src_28006.ds) AS ds__extract_doy + FROM ***************************.mf_time_spine time_spine_src_28006 ) subq_0 ) subq_1 GROUP BY diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0_optimized.sql index a5d07eba96..4ceb83d067 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_min_max_metric_time_week__plan0_optimized.sql @@ -8,7 +8,7 @@ FROM ( -- Pass Only Elements: ['metric_time__week',] SELECT DATE_TRUNC('week', ds) AS metric_time__week - FROM ***************************.mf_time_spine time_spine_src_28000 + FROM ***************************.mf_time_spine time_spine_src_28006 GROUP BY DATE_TRUNC('week', ds) ) subq_5 diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml index 0fe093d825..fef8f21032 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_1_semantic_model__dfp_0.xml @@ -42,11 +42,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -110,11 +110,11 @@ - + - + @@ -127,11 +127,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml index 0bf968b5aa..b431d0a228 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_metrics_from_2_semantic_models__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -46,11 +46,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml index 043ac63d08..2ddfeed739 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_2_ratio_metrics_from_1_semantic_model__dfp_0.xml @@ -27,11 +27,11 @@ - + - + @@ -53,11 +53,11 @@ - + - + @@ -88,11 +88,11 @@ - + - + @@ -114,11 +114,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml index 39de495060..2d63d5e1c5 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_3_metrics_from_2_semantic_models__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -46,11 +46,11 @@ - + - + @@ -72,11 +72,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml index 57dad2c6e2..4964340006 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_constrained_metric_not_combined__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -100,11 +100,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml index f77d573c61..b071f05bc6 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -50,11 +50,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml index d2cec259be..fb4c3516a7 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_derived_metric_with_non_derived_metric__dfp_0.xml @@ -20,11 +20,11 @@ - + - + @@ -53,11 +53,11 @@ - + - + @@ -79,11 +79,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml index 7edd301e94..14fc0c78b9 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_duplicate_measures__dfp_0.xml @@ -24,11 +24,11 @@ - + - + @@ -55,11 +55,11 @@ - + - + diff --git a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml index 9a7c8a6c17..b9181a179d 100644 --- a/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml +++ b/tests_metricflow/snapshots/test_source_scan_optimizer.py/DataflowPlan/test_nested_derived_metric__dfp_0.xml @@ -32,11 +32,11 @@ - + - + @@ -59,11 +59,11 @@ - + - + @@ -87,11 +87,11 @@ - + - + @@ -113,11 +113,11 @@ - + - + From 91862219fc6e0781293ec86a7db9b8aa117c6181 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Sat, 27 Jul 2024 00:07:55 -0700 Subject: [PATCH 4/4] Remove bad granularity assumptions --- .../metricflow_semantics/specs/time_dimension_spec.py | 7 ++++++- metricflow/dataflow/builder/node_evaluator.py | 11 +++++++---- metricflow/dataset/convert_semantic_model.py | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py index 4f7a844d5d..4212bfef01 100644 --- a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py +++ b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py @@ -101,7 +101,12 @@ def without_first_entity_link(self) -> TimeDimensionSpec: # noqa: D102 @property def without_entity_links(self) -> TimeDimensionSpec: # noqa: D102 - return TimeDimensionSpec.from_name(self.element_name) + return TimeDimensionSpec( + element_name=self.element_name, + time_granularity=self.time_granularity, + date_part=self.date_part, + entity_links=(), + ) @staticmethod def from_name(name: str) -> TimeDimensionSpec: # noqa: D102 diff --git a/metricflow/dataflow/builder/node_evaluator.py b/metricflow/dataflow/builder/node_evaluator.py index d22533be75..0c6715c3b9 100644 --- a/metricflow/dataflow/builder/node_evaluator.py +++ b/metricflow/dataflow/builder/node_evaluator.py @@ -200,14 +200,19 @@ def _find_joinable_candidate_nodes_that_can_satisfy_linkable_specs( candidates_for_join: List[JoinLinkableInstancesRecipe] = [] left_node_spec_set = left_node_instance_set.spec_set for right_node in self._nodes_available_for_joins: + data_set_in_right_node: SqlDataSet = self._node_data_set_resolver.get_output_data_set(right_node) + linkable_specs_in_right_node = data_set_in_right_node.instance_set.spec_set.linkable_specs + # If right node is time spine source node, use cross join. if right_node in self._time_spine_nodes: - needed_metric_time_specs = group_specs_by_type(needed_linkable_specs).metric_time_specs + satisfiable_metric_time_specs = set(needed_linkable_specs).intersection( + set(linkable_specs_in_right_node) + ) candidates_for_join.append( JoinLinkableInstancesRecipe( node_to_join=right_node, join_on_entity=None, - satisfiable_linkable_specs=list(needed_metric_time_specs), + satisfiable_linkable_specs=list(satisfiable_metric_time_specs), join_on_partition_dimensions=(), join_on_partition_time_dimensions=(), join_type=SqlJoinType.CROSS_JOIN, @@ -215,8 +220,6 @@ def _find_joinable_candidate_nodes_that_can_satisfy_linkable_specs( ) continue - data_set_in_right_node: SqlDataSet = self._node_data_set_resolver.get_output_data_set(right_node) - linkable_specs_in_right_node = data_set_in_right_node.instance_set.spec_set.linkable_specs entity_specs_in_right_node = data_set_in_right_node.instance_set.spec_set.entity_specs # For each unlinked entity in the data set, create a candidate for joining. diff --git a/metricflow/dataset/convert_semantic_model.py b/metricflow/dataset/convert_semantic_model.py index 198bdbce87..3304aefce3 100644 --- a/metricflow/dataset/convert_semantic_model.py +++ b/metricflow/dataset/convert_semantic_model.py @@ -104,7 +104,7 @@ def _create_time_dimension_instance( self, element_name: str, entity_links: Tuple[EntityReference, ...], - time_granularity: TimeGranularity = DEFAULT_TIME_GRANULARITY, + time_granularity: TimeGranularity, date_part: Optional[DatePart] = None, semantic_model_name: Optional[str] = None, ) -> TimeDimensionInstance: @@ -332,7 +332,7 @@ def _build_time_dimension_instances_and_columns( ) -> Tuple[List[TimeDimensionInstance], List[SqlSelectColumn]]: time_dimension_instances: List[TimeDimensionInstance] = [] select_columns: List[SqlSelectColumn] = [] - # Add time dimensions with a smaller granularity for ease in query resolution + # Add time dimensions with a larger granularity for ease in query resolution for time_granularity in TimeGranularity: if time_granularity.to_int() > defined_time_granularity.to_int(): time_dimension_instance = self._create_time_dimension_instance(