diff --git a/.changes/unreleased/Fixes-20240827-130128.yaml b/.changes/unreleased/Fixes-20240827-130128.yaml new file mode 100644 index 0000000000..36efbf6188 --- /dev/null +++ b/.changes/unreleased/Fixes-20240827-130128.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: 'Bug fix: ensure that granularity requested for non-additive dimension is respected.' +time: 2024-08-27T13:01:28.743199-07:00 +custom: + Author: courtneyholcomb + Issue: "1383" diff --git a/metricflow-semantics/metricflow_semantics/specs/non_additive_dimension_spec.py b/metricflow-semantics/metricflow_semantics/specs/non_additive_dimension_spec.py index ff88b6e0a1..24fc88603e 100644 --- a/metricflow-semantics/metricflow_semantics/specs/non_additive_dimension_spec.py +++ b/metricflow-semantics/metricflow_semantics/specs/non_additive_dimension_spec.py @@ -5,7 +5,7 @@ from typing import Any, Sequence, Tuple from dbt_semantic_interfaces.dataclass_serialization import SerializableDataclass -from dbt_semantic_interfaces.type_enums import AggregationType +from dbt_semantic_interfaces.type_enums import AggregationType, TimeGranularity from metricflow_semantics.specs.entity_spec import LinklessEntitySpec from metricflow_semantics.specs.instance_spec import LinkableInstanceSpec @@ -40,9 +40,10 @@ def bucket_hash(self) -> str: values.extend(sorted(self.window_groupings)) return hash_items(values) - @property - def linkable_specs(self) -> Sequence[LinkableInstanceSpec]: # noqa: D102 - return (TimeDimensionSpec.from_name(self.name),) + tuple( + def linkable_specs( # noqa: D102 + self, non_additive_dimension_grain: TimeGranularity + ) -> Sequence[LinkableInstanceSpec]: + return (TimeDimensionSpec.from_name(self.name).with_grain(non_additive_dimension_grain),) + tuple( LinklessEntitySpec.from_element_name(entity_name) for entity_name in self.window_groupings ) diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/accounts_source.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/accounts_source.yaml index 64167b1aee..4a9b5e5131 100644 --- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/accounts_source.yaml +++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/accounts_source.yaml @@ -30,11 +30,25 @@ semantic_model: window_groupings: - user + - name: total_account_balance_first_day_of_month + agg: sum + expr: account_balance + agg_time_dimension: ds_month + non_additive_dimension: + name: ds_month + window_choice: min + create_metric: true + dimensions: - name: ds type: time type_params: time_granularity: day + - name: ds_month + type: time + expr: ds_month + type_params: + time_granularity: month - name: account_type type: categorical diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt index b82594b691..e8bb14b34b 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt @@ -158,6 +158,7 @@ 'user__account__user__current_account_balance_by_user', 'user__account__user__regional_starting_balance_ratios', 'user__account__user__total_account_balance_first_day', + 'user__account__user__total_account_balance_first_day_of_month', 'user__active_listings', 'user__archived_at__day', 'user__archived_at__extract_day', @@ -461,6 +462,7 @@ 'user__smallest_listing', 'user__subdaily_join_to_time_spine_metric', 'user__total_account_balance_first_day', + 'user__total_account_balance_first_day_of_month', 'user__verification__user__identity_verifications', 'user__view__user__views', 'user__views', diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt index 6204c4d106..d99416910c 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt @@ -9,6 +9,7 @@ 'created_at', 'ds', 'ds_latest', + 'ds_month', 'ds_partitioned', 'home_state', 'home_state_latest', @@ -46,6 +47,7 @@ 'referred_bookings', 'smallest_listing', 'total_account_balance_first_day', + 'total_account_balance_first_day_of_month', 'txn_revenue', 'views', 'visitors', diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt index f5230b4b01..8e7a823ed4 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt @@ -119,6 +119,7 @@ Model Join-Path Entity Links ('listings_latest',) ("('user',)", "('account', 'user')") current_account_balance_by_user ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('account', 'user')") regional_starting_balance_ratios ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('account', 'user')") total_account_balance_first_day ['JOINED', 'METRIC'] +('listings_latest',) ("('user',)", "('account', 'user')") total_account_balance_first_day_of_month ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('listing', 'user')") active_listings ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('listing', 'user')") approximate_continuous_booking_value_p99 ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('listing', 'user')") approximate_discrete_booking_value_p99 ['JOINED', 'METRIC'] @@ -193,6 +194,7 @@ Model Join-Path Entity Links ('listings_latest',) ("('user',)", "('user',)") smallest_listing ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") subdaily_join_to_time_spine_metric ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") total_account_balance_first_day ['JOINED', 'METRIC'] +('listings_latest',) ("('user',)", "('user',)") total_account_balance_first_day_of_month ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") views ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") visit_buy_conversion_rate ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") visit_buy_conversion_rate_7days ['JOINED', 'METRIC'] 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 d14fbc6b49..1604d2383e 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 @@ -7,6 +7,10 @@ 'account__ds__extract_month', 'account__ds__extract_quarter', 'account__ds__extract_year', + 'account__ds_month__extract_month', + 'account__ds_month__extract_quarter', + 'account__ds_month__extract_year', + 'account__ds_month__month', 'account__user', 'booking__ds__day', 'booking__ds__extract_day', @@ -104,6 +108,7 @@ 'company__user__company__smallest_listing', 'company__user__company__subdaily_join_to_time_spine_metric', 'company__user__company__total_account_balance_first_day', + 'company__user__company__total_account_balance_first_day_of_month', 'company__user__company__views', 'company__user__company__visit_buy_conversion_rate', 'company__user__company__visit_buy_conversion_rate_7days', @@ -448,6 +453,7 @@ 'user__account__user__current_account_balance_by_user', 'user__account__user__regional_starting_balance_ratios', 'user__account__user__total_account_balance_first_day', + 'user__account__user__total_account_balance_first_day_of_month', 'user__active_listings', 'user__archived_at__extract_day', 'user__archived_at__extract_dow', @@ -577,6 +583,7 @@ 'user__smallest_listing', 'user__subdaily_join_to_time_spine_metric', 'user__total_account_balance_first_day', + 'user__total_account_balance_first_day_of_month', 'user__verification__user__identity_verifications', 'user__view__user__views', 'user__views', diff --git a/metricflow/dataflow/builder/dataflow_plan_builder.py b/metricflow/dataflow/builder/dataflow_plan_builder.py index 9538f1c87f..795dc3cdea 100644 --- a/metricflow/dataflow/builder/dataflow_plan_builder.py +++ b/metricflow/dataflow/builder/dataflow_plan_builder.py @@ -1348,8 +1348,13 @@ def __get_required_and_extraneous_linkable_specs( for filter_spec in filter_specs: linkable_spec_sets_to_merge.append(LinkableSpecSet.create_from_specs(filter_spec.linkable_specs)) if non_additive_dimension_spec: + non_additive_dimension_grain = self._semantic_model_lookup.get_defined_time_granularity( + TimeDimensionReference(non_additive_dimension_spec.name) + ) linkable_spec_sets_to_merge.append( - LinkableSpecSet.create_from_specs(non_additive_dimension_spec.linkable_specs) + LinkableSpecSet.create_from_specs( + non_additive_dimension_spec.linkable_specs(non_additive_dimension_grain) + ) ) extraneous_linkable_specs = LinkableSpecSet.merge_iterable(linkable_spec_sets_to_merge).dedupe() @@ -1543,6 +1548,9 @@ def _build_aggregated_measure_from_measure_source_node( if non_additive_dimension_spec is not None: # Apply semi additive join on the node agg_time_dimension = measure_properties.agg_time_dimension + non_additive_dimension_grain = self._semantic_model_lookup.get_defined_time_granularity( + TimeDimensionReference(non_additive_dimension_spec.name) + ) queried_time_dimension_spec: Optional[ TimeDimensionSpec ] = self._find_non_additive_dimension_in_linkable_specs( @@ -1550,7 +1558,9 @@ def _build_aggregated_measure_from_measure_source_node( linkable_specs=queried_linkable_specs.as_tuple, non_additive_dimension_spec=non_additive_dimension_spec, ) - time_dimension_spec = TimeDimensionSpec.from_name(non_additive_dimension_spec.name) + time_dimension_spec = TimeDimensionSpec.from_name(non_additive_dimension_spec.name).with_grain( + time_granularity=non_additive_dimension_grain + ) window_groupings = tuple( LinklessEntitySpec.from_element_name(name) for name in non_additive_dimension_spec.window_groupings ) diff --git a/tests_metricflow/fixtures/source_table_snapshots/simple_model/fct_accounts.yaml b/tests_metricflow/fixtures/source_table_snapshots/simple_model/fct_accounts.yaml index b49e3e17b8..132f674e2c 100644 --- a/tests_metricflow/fixtures/source_table_snapshots/simple_model/fct_accounts.yaml +++ b/tests_metricflow/fixtures/source_table_snapshots/simple_model/fct_accounts.yaml @@ -3,6 +3,8 @@ table_snapshot: column_definitions: - name: ds type: TIME + - name: ds_month + type: TIME - name: user_id type: STRING - name: account_balance @@ -10,18 +12,18 @@ table_snapshot: - name: account_type type: STRING rows: - - ["2020-01-01", "u0004114", "2135", "checking"] - - ["2020-01-01", "u0004114", "1234", "savings"] - - ["2020-01-01", "u0003141", "24634", "checking"] - - ["2020-01-01", "u0003154", "23452", "checking"] - - ["2020-01-02", "u1612112", "5123", "checking"] - - ["2020-01-02", "u0005432", "8456", "savings"] - - ["2020-01-02", "u0003452", "6939", "checking"] - - ["2020-01-03", "u0005432", "5234", "checking"] - - ["2020-01-03", "u0005432", "234", "savings"] - - ["2020-01-04", "u0005414", "5582", "savings"] - - ["2020-01-06", "u0004114", "1213", "savings"] - - ["2020-01-07", "u0004114", "523", "checking"] - - ["2020-01-10", "u0004114", "7434", "checkings"] - - ["2020-01-12", "u0003141", "12939", "checking"] - - ["2020-01-12", "u0003452", "35", "checking"] + - ["2020-01-01", "2020-01-01", "u0004114", "2135", "checking"] + - ["2020-01-01", "2020-01-01", "u0004114", "1234", "savings"] + - ["2020-01-01", "2020-01-01", "u0003141", "24634", "checking"] + - ["2020-01-01", "2020-01-01", "u0003154", "23452", "checking"] + - ["2020-01-02", "2020-01-01", "u1612112", "5123", "checking"] + - ["2020-01-02", "2020-01-01", "u0005432", "8456", "savings"] + - ["2020-01-02", "2020-01-01", "u0003452", "6939", "checking"] + - ["2020-01-03", "2020-01-01", "u0005432", "5234", "checking"] + - ["2020-01-03", "2020-01-01", "u0005432", "234", "savings"] + - ["2020-01-04", "2020-01-01", "u0005414", "5582", "savings"] + - ["2020-01-06", "2020-01-01", "u0004114", "1213", "savings"] + - ["2020-01-07", "2020-01-01", "u0004114", "523", "checking"] + - ["2020-01-10", "2020-01-01", "u0004114", "7434", "checkings"] + - ["2020-01-12", "2020-01-01", "u0003141", "12939", "checking"] + - ["2020-01-12", "2020-01-01", "u0003452", "35", "checking"] diff --git a/tests_metricflow/integration/test_cases/itest_semi_additive_measure.yaml b/tests_metricflow/integration/test_cases/itest_semi_additive_measure.yaml index 59cb7429f3..58aec8cc0e 100644 --- a/tests_metricflow/integration/test_cases/itest_semi_additive_measure.yaml +++ b/tests_metricflow/integration/test_cases/itest_semi_additive_measure.yaml @@ -259,3 +259,24 @@ integration_test: b.ds = d.ds__complete GROUP BY b.account_type +--- +integration_test: + name: non_default_grain + description: Tests selecting a semi-additive measure with an agg_time_dimension that has non-default grain + model: SIMPLE_MODEL + metrics: ["total_account_balance_first_day_of_month"] + check_query: | + SELECT + SUM(subq_2.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + SELECT + {{ render_date_trunc("ds", TimeGranularity.MONTH) }} AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM {{ source_schema }}.fct_accounts + ) subq_2 + INNER JOIN ( + SELECT + MIN({{ render_date_trunc("ds", TimeGranularity.MONTH) }}) AS ds_month__month__complete + FROM {{ source_schema }}.fct_accounts + ) subq_4 + ON subq_2.ds_month__month = subq_4.ds_month__month__complete diff --git a/tests_metricflow/query_rendering/test_query_rendering.py b/tests_metricflow/query_rendering/test_query_rendering.py index b96c5786d2..b4398a0335 100644 --- a/tests_metricflow/query_rendering/test_query_rendering.py +++ b/tests_metricflow/query_rendering/test_query_rendering.py @@ -565,3 +565,26 @@ def test_min_max_metric_time_week( dataflow_plan_builder=dataflow_plan_builder, query_spec=query_spec, ) + + +@pytest.mark.sql_engine_snapshot +def test_non_additive_dimension_with_non_default_grain( + request: FixtureRequest, + mf_test_configuration: MetricFlowTestConfiguration, + dataflow_plan_builder: DataflowPlanBuilder, + sql_client: SqlClient, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, +) -> None: + """Tests querying a metric with a non-additive agg_time_dimension that has non-default granularity.""" + query_spec = MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="total_account_balance_first_day_of_month"),) + ) + + render_and_check( + request=request, + mf_test_configuration=mf_test_configuration, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + dataflow_plan_builder=dataflow_plan_builder, + query_spec=query_spec, + ) diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml index 8793465e07..86e051ae95 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml @@ -244,138 +244,138 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -699,147 +699,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1270,137 +1270,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml index 05827c801d..18a94623a9 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml @@ -326,147 +326,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -865,147 +865,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1436,137 +1436,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml index 4f1a1debb6..6c66869cfc 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml @@ -272,138 +272,138 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -758,147 +758,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1329,137 +1329,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml index 0e47d15bbd..0d74b8ffe5 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml @@ -295,138 +295,138 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -818,147 +818,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1389,137 +1389,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml index f18c79eea4..98e96bd7bf 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml @@ -247,138 +247,138 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -702,147 +702,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1273,137 +1273,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml index f63906f119..202d16ee1f 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml @@ -295,138 +295,138 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -806,147 +806,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1377,137 +1377,137 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 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 fef8f21032..3e238cc281 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,7 +42,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -127,7 +127,7 @@ - + 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 bf54d2fce4..b525e0d0fe 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,7 +22,7 @@ - + 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 0db2f56fd7..1fae1308e4 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,7 +16,7 @@ - + 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 67442fc6af..dbe0527c9a 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,7 +34,7 @@ - + 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 244821dae7..1f0d6c8ddd 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,7 +23,7 @@ - + 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 bdae25ff6b..2efe5aa275 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,7 +38,7 @@ - + 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 1e6217f25c..e60cd4ce07 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,7 +24,7 @@ - + @@ -61,7 +61,7 @@ - + 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 f1a363e216..5146d02f68 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,7 +36,7 @@ - + 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 91f4aac2d3..bc9790a704 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,7 +36,7 @@ - + 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 67373508a6..5055b1e115 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,7 +42,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 7760e7b9c3..ce964af845 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,7 +16,7 @@ - + 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 3ecf955c35..c869b82bf5 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,7 +34,7 @@ - + @@ -86,7 +86,7 @@ - + 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 668ed3edad..553d97b92d 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,7 +147,7 @@ - + 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 8894c05413..f1f04adbbe 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,7 +27,7 @@ - + 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 e176f164e6..727ccd4696 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,7 +22,7 @@ - + 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 dd95dca8e0..041f258d06 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,7 +47,7 @@ - + @@ -64,7 +64,7 @@ - + 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 58fe24e376..c265115098 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,7 +21,7 @@ - + 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 01ef085957..513d59195e 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,7 +162,7 @@ - + @@ -180,7 +180,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -366,7 +366,7 @@ - + @@ -397,7 +397,7 @@ - + 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 e186ee1481..b9d5262d37 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,7 +124,7 @@ - + @@ -152,7 +152,7 @@ - + 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 355d69e546..8586871725 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,7 +67,7 @@ - + @@ -102,7 +102,7 @@ - + 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 26a64602d6..2a6db6ce4a 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,7 +93,7 @@ - + @@ -128,7 +128,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 dae988091d..337915e429 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,7 +47,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -132,7 +132,7 @@ - + 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 439a216e2e..fca709df16 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,7 +25,7 @@ - + @@ -57,7 +57,7 @@ - + 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 278978a74c..323e1990f6 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,7 +53,7 @@ - + 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 22af651f78..17b6a97992 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,7 +146,7 @@ - + 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 0d99a4a2e3..3316ce438a 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,7 +150,7 @@ - + @@ -258,7 +258,7 @@ - + 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 3354f7bf20..8b94cd3388 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,7 +27,7 @@ - + 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 39c81616f4..7830d4624c 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,7 +21,7 @@ - + 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 39c81616f4..7830d4624c 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,7 +21,7 @@ - + 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 61675b49ee..79a3605555 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,7 +47,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -132,7 +132,7 @@ - + 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 55109326af..84b8ef2d20 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,7 +163,7 @@ - + @@ -180,7 +180,7 @@ - + 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 4226540ce0..3c79e8f8dc 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,7 +102,7 @@ - + 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 4c900a8ec5..a38f86e1df 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,7 +141,7 @@ - + @@ -158,7 +158,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql index 603cac9c69..e2ed178360 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql index 090ed3d620..cedc4b3f63 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(ds, day) AS ds__day , DATETIME_TRUNC(ds, isoweek) AS ds__week , DATETIME_TRUNC(ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATETIME_TRUNC(ds, day) AS account__ds__day , DATETIME_TRUNC(ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql index 204e39e8d3..aadb6dc88c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 7bc2a27483..497a35620c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(ds, day) AS ds__day , DATETIME_TRUNC(ds, isoweek) AS ds__week , DATETIME_TRUNC(ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATETIME_TRUNC(ds, day) AS account__ds__day , DATETIME_TRUNC(ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 15a982bc1b..5fabcdcbe3 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index adb1d564c8..98354966a5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATETIME_TRUNC(ds, day) AS ds__day , DATETIME_TRUNC(ds, isoweek) AS ds__week , DATETIME_TRUNC(ds, month) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS ds__extract_dow , EXTRACT(dayofyear FROM ds) AS ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATETIME_TRUNC(ds, day) AS account__ds__day , DATETIME_TRUNC(ds, isoweek) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , IF(EXTRACT(dayofweek FROM ds) = 1, 7, EXTRACT(dayofweek FROM ds) - 1) AS account__ds__extract_dow , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy + , DATETIME_TRUNC(ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql index 44b9beb062..30647d37e7 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql index 898e433670..537a61a682 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql index 2b69c18f94..bc60d5b464 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index c29e6b7c0e..e8106c8ce7 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 483cb8a7b8..03b63bc149 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 593e991f90..16be767079 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAYOFWEEK_ISO FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql index 7e857e24d3..27fe212233 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql index d159a6215c..a30ec670bb 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql index f6d73bba58..5fc8b61427 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 23e7270ba7..b323d6047d 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql index d15252a07e..71632426c5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 2059c7c53a..bd64d6062f 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql index 7e857e24d3..27fe212233 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql index d159a6215c..a30ec670bb 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql index f6d73bba58..5fc8b61427 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 23e7270ba7..b323d6047d 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql index d15252a07e..71632426c5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 2059c7c53a..bd64d6062f 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(isodow FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(isodow FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql index e0da6b368c..ed7d26e6c8 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql index 8790159c85..b2005e7d9b 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql index 9a90e73c6d..7e2461e8f2 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 406c588c63..642d8be45a 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql index fbc5127dc6..ac493633cc 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index f81ddba6c9..a83258d3a5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , CASE WHEN EXTRACT(dow FROM ds) = 0 THEN EXTRACT(dow FROM ds) + 7 ELSE EXTRACT(dow FROM ds) END AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql index 07052ef0f2..4c8d1b9708 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql index e2dc17ba69..797894a245 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql index f465bab0f9..4a4d9047a7 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index 9e9d03bd02..140db6e080 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql index bc47f78312..95cedb1499 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 14d2446f48..f8b674a6d7 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(dayofweekiso FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql index f9ca1bb92e..1d8628cef6 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -73,6 +99,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -84,6 +111,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -96,6 +129,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql index fcf6da5d40..3cc00c2223 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql index 891a5e7634..dd376606d2 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index c5d4f50c46..63dc09dc9a 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql index 153ba096c5..36860fc374 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -11,6 +11,12 @@ SELECT , subq_0.ds__extract_day AS ds__extract_day , subq_0.ds__extract_dow AS ds__extract_dow , subq_0.ds__extract_doy AS ds__extract_doy + , subq_0.ds_month__month AS ds_month__month + , subq_0.ds_month__quarter AS ds_month__quarter + , subq_0.ds_month__year AS ds_month__year + , subq_0.ds_month__extract_year AS ds_month__extract_year + , subq_0.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_0.ds_month__extract_month AS ds_month__extract_month , subq_0.account__ds__day AS account__ds__day , subq_0.account__ds__week AS account__ds__week , subq_0.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_0.account__ds__extract_day AS account__ds__extract_day , subq_0.account__ds__extract_dow AS account__ds__extract_dow , subq_0.account__ds__extract_doy AS account__ds__extract_doy + , subq_0.account__ds_month__month AS account__ds_month__month + , subq_0.account__ds_month__quarter AS account__ds_month__quarter + , subq_0.account__ds_month__year AS account__ds_month__year + , subq_0.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month AS account__ds_month__extract_month , subq_0.user AS user , subq_0.account__user AS account__user , subq_0.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_0.account_balance AS account_balance , subq_0.total_account_balance_first_day AS total_account_balance_first_day , subq_0.current_account_balance_by_user AS current_account_balance_by_user + , subq_0.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user @@ -74,6 +100,7 @@ INNER JOIN ( accounts_source_src_28000.account_balance , accounts_source_src_28000.account_balance AS total_account_balance_first_day , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month @@ -85,6 +112,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month , accounts_source_src_28000.account_type , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week @@ -97,6 +130,12 @@ INNER JOIN ( , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month , accounts_source_src_28000.account_type AS account__account_type , accounts_source_src_28000.user_id AS user , accounts_source_src_28000.user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index fe4e69f567..0b1b03f831 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -11,6 +11,12 @@ SELECT , subq_3.ds__extract_day AS ds__extract_day , subq_3.ds__extract_dow AS ds__extract_dow , subq_3.ds__extract_doy AS ds__extract_doy + , subq_3.ds_month__month AS ds_month__month + , subq_3.ds_month__quarter AS ds_month__quarter + , subq_3.ds_month__year AS ds_month__year + , subq_3.ds_month__extract_year AS ds_month__extract_year + , subq_3.ds_month__extract_quarter AS ds_month__extract_quarter + , subq_3.ds_month__extract_month AS ds_month__extract_month , subq_3.account__ds__day AS account__ds__day , subq_3.account__ds__week AS account__ds__week , subq_3.account__ds__month AS account__ds__month @@ -22,6 +28,12 @@ SELECT , subq_3.account__ds__extract_day AS account__ds__extract_day , subq_3.account__ds__extract_dow AS account__ds__extract_dow , subq_3.account__ds__extract_doy AS account__ds__extract_doy + , subq_3.account__ds_month__month AS account__ds_month__month + , subq_3.account__ds_month__quarter AS account__ds_month__quarter + , subq_3.account__ds_month__year AS account__ds_month__year + , subq_3.account__ds_month__extract_year AS account__ds_month__extract_year + , subq_3.account__ds_month__extract_quarter AS account__ds_month__extract_quarter + , subq_3.account__ds_month__extract_month AS account__ds_month__extract_month , subq_3.user AS user , subq_3.account__user AS account__user , subq_3.account_type AS account_type @@ -29,12 +41,14 @@ SELECT , subq_3.account_balance AS account_balance , subq_3.total_account_balance_first_day AS total_account_balance_first_day , subq_3.current_account_balance_by_user AS current_account_balance_by_user + , subq_3.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month FROM ( -- Read Elements From Semantic Model 'accounts_source' SELECT account_balance , account_balance AS total_account_balance_first_day , account_balance AS current_account_balance_by_user + , account_balance AS total_account_balance_first_day_of_month , DATE_TRUNC('day', ds) AS ds__day , DATE_TRUNC('week', ds) AS ds__week , DATE_TRUNC('month', ds) AS ds__month @@ -46,6 +60,12 @@ FROM ( , EXTRACT(day FROM ds) AS ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS ds__extract_dow , EXTRACT(doy FROM ds) AS ds__extract_doy + , DATE_TRUNC('month', ds_month) AS ds_month__month + , DATE_TRUNC('quarter', ds_month) AS ds_month__quarter + , DATE_TRUNC('year', ds_month) AS ds_month__year + , EXTRACT(year FROM ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS ds_month__extract_month , account_type , DATE_TRUNC('day', ds) AS account__ds__day , DATE_TRUNC('week', ds) AS account__ds__week @@ -58,6 +78,12 @@ FROM ( , EXTRACT(day FROM ds) AS account__ds__extract_day , EXTRACT(DAY_OF_WEEK FROM ds) AS account__ds__extract_dow , EXTRACT(doy FROM ds) AS account__ds__extract_doy + , DATE_TRUNC('month', ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', ds_month) AS account__ds_month__year + , EXTRACT(year FROM ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM ds_month) AS account__ds_month__extract_month , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml index 519599da2b..933961b64d 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_combine_output_node__plan0.xml @@ -73,29 +73,29 @@ - + - + - + - + - + - + @@ -105,334 +105,334 @@ - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -489,29 +489,29 @@ - + - + - + - + - + - + @@ -521,334 +521,334 @@ - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml index b57bd3341e..f411e4014f 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml @@ -76,32 +76,32 @@ - + - + - + - + - + - + @@ -111,373 +111,373 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -509,259 +509,259 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index 6582795a6b..c7b4c40da5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -670,32 +670,32 @@ - + - + - + - + - + - + @@ -705,397 +705,397 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1476,277 +1476,277 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -2188,242 +2188,242 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -2804,277 +2804,277 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml index 1a3a7551d4..a59b15b10c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml @@ -84,32 +84,32 @@ - + - + - + - + - + - + @@ -119,373 +119,373 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -517,259 +517,259 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml index 9e67e7a2cc..b49e0adda0 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -81,32 +81,32 @@ - + - + - + - + - + - + @@ -116,373 +116,373 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -514,259 +514,259 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml index 6decb3d819..3dbb6ba474 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_constrain_time_range_node__plan0.xml @@ -41,29 +41,29 @@ - + - + - + - + - + - + @@ -73,334 +73,334 @@ - + - + - + - + - + - - - + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml index 0a1d09c6ae..8dd230473f 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml @@ -424,225 +424,225 @@ - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -671,126 +671,126 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index b1a70ffcf0..300613c35e 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -217,195 +217,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -428,115 +428,115 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml index bd9ed18639..b918bd59b9 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_node__plan0.xml @@ -16,19 +16,19 @@ - + - + - - + + - + - + @@ -36,232 +36,232 @@ - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml index 0120048169..1874c79979 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_filter_with_where_constraint_node__plan0.xml @@ -26,26 +26,26 @@ - + - + - + - + - + - + @@ -55,286 +55,286 @@ - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml index a7bb0593ae..6af78e498c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_to_grain__plan0.xml @@ -560,32 +560,32 @@ - + - + - + - + - + - + @@ -595,388 +595,388 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml index a7bb0593ae..6af78e498c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_with_offset_window__plan0.xml @@ -560,32 +560,32 @@ - + - + - + - + - + - + @@ -595,388 +595,388 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml index a7bb0593ae..6af78e498c 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_time_spine_node_without_offset__plan0.xml @@ -560,32 +560,32 @@ - + - + - + - + - + - + @@ -595,388 +595,388 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml index d8675f5ef6..b09ebddd6b 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_measure_aggregation_node__plan0.xml @@ -49,26 +49,26 @@ - + - + - + - + - + - + @@ -78,286 +78,286 @@ - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml index 5f2f3d21d7..c4b1c0ba82 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml @@ -44,26 +44,26 @@ - + - + - + - + - + - + @@ -73,286 +73,286 @@ - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + @@ -378,195 +378,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -592,195 +592,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml index a4e916df12..1e77d67666 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_order_by_node__plan0.xml @@ -62,32 +62,32 @@ - + - + - + - + - + - + @@ -97,373 +97,373 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml index e8e9e091c9..20240bfc48 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node__plan0.xml @@ -2,59 +2,97 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + @@ -80,51 +118,91 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + @@ -163,73 +241,126 @@ - - - - - - + + + + + + + + + + + - + - + - - - + + + - - - - + + - - - + + + - - - + + + + + + - + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml index 4672ad8a85..0df41dcf95 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_grouping__plan0.xml @@ -2,59 +2,97 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + @@ -80,51 +118,91 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + @@ -165,73 +243,126 @@ - - - - - - + + + + + + + + + + + - + - + - - - + + + - - - - + + - - - + + + - - - + + + + + + - + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml index b084372526..5f6b8666ce 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_semi_additive_join_node_with_queried_group_by__plan0.xml @@ -2,59 +2,97 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + @@ -80,51 +118,91 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + @@ -165,73 +243,126 @@ - - - - - - + + + + + + + + + + + - + - + - - - + + + - - - - + + - - - + + + - - - + + + + + + - + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml index 00a302afef..b48eaf8fbc 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_single_join_node__plan0.xml @@ -33,26 +33,26 @@ - + - + - + - + - + - + @@ -62,286 +62,286 @@ - + - + - + - + - + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + @@ -371,195 +371,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml index 95ba58e76a..eb50a8c932 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_source_node__plan0.xml @@ -8,192 +8,192 @@ - + - + - - + + - + - + - + - + - + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - + + - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - + + + diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml index b63265b985..6e100f3b8a 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml @@ -428,225 +428,225 @@ - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -675,126 +675,126 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index b1a70ffcf0..300613c35e 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -217,195 +217,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -428,115 +428,115 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml index 63b2a8198a..63551a11fe 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.xml @@ -238,19 +238,19 @@ - + - + - - + + - + - + @@ -258,232 +258,232 @@ - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml index 5c24614180..a9ed1f6acb 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_metric_time_dimension_transform_node_using_primary_time__plan0.xml @@ -265,19 +265,19 @@ - + - + - - + + - + - + @@ -285,232 +285,232 @@ - + - + - + - + - + - - - - - - - + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml index 93bfcd16a4..16ec88a413 100644 --- a/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/test_simple_query_with_metric_time_dimension__plan0.xml @@ -553,32 +553,32 @@ - + - + - + - + - + - + @@ -588,388 +588,388 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1459,32 +1459,32 @@ - + - + - + - + - + - + @@ -1494,388 +1494,388 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 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 8ec7e633d2..b3edf37123 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 @@ -442,225 +442,225 @@ - + - + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -791,49 +791,49 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -864,126 +864,126 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 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 6bf34b30a5..19e8aede9e 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 @@ -72,21 +72,21 @@ - - - - - + + + + + - + - + - - - + + + - + 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 dac8a4ae04..740834612f 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 @@ -73,21 +73,21 @@ - - - - - + + + + + - + - + - - - + + + - + 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 58e50bc745..c55d744387 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 @@ -230,195 +230,195 @@ - + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + @@ -540,43 +540,43 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -603,115 +603,115 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/tests_metricflow/snapshots/test_mf_engine.py/list/test_list_dimensions__result0.txt b/tests_metricflow/snapshots/test_mf_engine.py/list/test_list_dimensions__result0.txt index 1c37af0880..1b5302911f 100644 --- a/tests_metricflow/snapshots/test_mf_engine.py/list/test_list_dimensions__result0.txt +++ b/tests_metricflow/snapshots/test_mf_engine.py/list/test_list_dimensions__result0.txt @@ -1,6 +1,7 @@ [ 'account__account_type', 'account__ds', + 'account__ds_month', 'booking__ds', 'booking__ds_partitioned', 'booking__is_instant', 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 36a3aaae53..508028c4e9 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,7 +153,7 @@ - + @@ -257,7 +257,7 @@ - + @@ -284,7 +284,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 3fd12a5735..40a2704f90 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,7 +155,7 @@ - + @@ -173,7 +173,7 @@ - + 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 05e5480fbe..fa96c0fc07 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,7 +211,7 @@ - + @@ -229,7 +229,7 @@ - + @@ -423,7 +423,7 @@ - + @@ -442,7 +442,7 @@ - + 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 f6f53d7377..306327193a 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,7 +242,7 @@ - + @@ -260,7 +260,7 @@ - + @@ -485,7 +485,7 @@ - + @@ -504,7 +504,7 @@ - + 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 512cdc0fce..14cfac8d48 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,7 +201,7 @@ - + @@ -219,7 +219,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -420,7 +420,7 @@ - + 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 80357bff35..2070c49cf8 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,7 +143,7 @@ - + @@ -160,7 +160,7 @@ - + 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 621a7a9449..f6be93d338 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,7 +119,7 @@ - + @@ -136,7 +136,7 @@ - + diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..bf796aec43 --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATETIME_TRUNC(accounts_source_src_28000.ds, day) AS account__ds__day + , DATETIME_TRUNC(accounts_source_src_28000.ds, isoweek) AS account__ds__week + , DATETIME_TRUNC(accounts_source_src_28000.ds, month) AS account__ds__month + , DATETIME_TRUNC(accounts_source_src_28000.ds, quarter) AS account__ds__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds, year) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , IF(EXTRACT(dayofweek FROM accounts_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM accounts_source_src_28000.ds) - 1) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, month) AS account__ds_month__month + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, quarter) AS account__ds_month__quarter + , DATETIME_TRUNC(accounts_source_src_28000.ds_month, year) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..97055bf54c --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATETIME_TRUNC(ds_month, month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATETIME_TRUNC(ds_month, month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..308afbf3dd --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..c4eac70b4c --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..c4eac70b4c --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(isodow FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..df5d0dfc59 --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , CASE WHEN EXTRACT(dow FROM accounts_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM accounts_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM accounts_source_src_28000.ds) END AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..bc4617368b --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(dayofweekiso FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0.sql new file mode 100644 index 0000000000..5b3083b605 --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0.sql @@ -0,0 +1,230 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.total_account_balance_first_day_of_month +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_6.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month',] + SELECT + subq_5.total_account_balance_first_day_of_month + FROM ( + -- Join on MIN(ds_month) and [] grouping by None + SELECT + subq_2.ds_month__month AS ds_month__month + , subq_2.total_account_balance_first_day_of_month AS total_account_balance_first_day_of_month + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + INNER JOIN ( + -- Filter row on MIN(ds_month__month) + SELECT + MIN(subq_3.ds_month__month) AS ds_month__month__complete + FROM ( + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + subq_1.ds_month__month + , subq_1.total_account_balance_first_day_of_month + FROM ( + -- Metric Time Dimension 'ds_month' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_month__month + , subq_0.ds_month__quarter + , subq_0.ds_month__year + , subq_0.ds_month__extract_year + , subq_0.ds_month__extract_quarter + , subq_0.ds_month__extract_month + , subq_0.account__ds__day + , subq_0.account__ds__week + , subq_0.account__ds__month + , subq_0.account__ds__quarter + , subq_0.account__ds__year + , subq_0.account__ds__extract_year + , subq_0.account__ds__extract_quarter + , subq_0.account__ds__extract_month + , subq_0.account__ds__extract_day + , subq_0.account__ds__extract_dow + , subq_0.account__ds__extract_doy + , subq_0.account__ds_month__month + , subq_0.account__ds_month__quarter + , subq_0.account__ds_month__year + , subq_0.account__ds_month__extract_year + , subq_0.account__ds_month__extract_quarter + , subq_0.account__ds_month__extract_month + , subq_0.ds_month__month AS metric_time__month + , subq_0.ds_month__quarter AS metric_time__quarter + , subq_0.ds_month__year AS metric_time__year + , subq_0.ds_month__extract_year AS metric_time__extract_year + , subq_0.ds_month__extract_quarter AS metric_time__extract_quarter + , subq_0.ds_month__extract_month AS metric_time__extract_month + , subq_0.user + , subq_0.account__user + , subq_0.account_type + , subq_0.account__account_type + , subq_0.total_account_balance_first_day_of_month + FROM ( + -- Read Elements From Semantic Model 'accounts_source' + SELECT + accounts_source_src_28000.account_balance + , accounts_source_src_28000.account_balance AS total_account_balance_first_day + , accounts_source_src_28000.account_balance AS current_account_balance_by_user + , accounts_source_src_28000.account_balance AS total_account_balance_first_day_of_month + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS ds_month__extract_month + , accounts_source_src_28000.account_type + , DATE_TRUNC('day', accounts_source_src_28000.ds) AS account__ds__day + , DATE_TRUNC('week', accounts_source_src_28000.ds) AS account__ds__week + , DATE_TRUNC('month', accounts_source_src_28000.ds) AS account__ds__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds) AS account__ds__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds) AS account__ds__year + , EXTRACT(year FROM accounts_source_src_28000.ds) AS account__ds__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds) AS account__ds__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds) AS account__ds__extract_month + , EXTRACT(day FROM accounts_source_src_28000.ds) AS account__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM accounts_source_src_28000.ds) AS account__ds__extract_dow + , EXTRACT(doy FROM accounts_source_src_28000.ds) AS account__ds__extract_doy + , DATE_TRUNC('month', accounts_source_src_28000.ds_month) AS account__ds_month__month + , DATE_TRUNC('quarter', accounts_source_src_28000.ds_month) AS account__ds_month__quarter + , DATE_TRUNC('year', accounts_source_src_28000.ds_month) AS account__ds_month__year + , EXTRACT(year FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_year + , EXTRACT(quarter FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_quarter + , EXTRACT(month FROM accounts_source_src_28000.ds_month) AS account__ds_month__extract_month + , accounts_source_src_28000.account_type AS account__account_type + , accounts_source_src_28000.user_id AS user + , accounts_source_src_28000.user_id AS account__user + FROM ***************************.fct_accounts accounts_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_3 + ) subq_4 + ON + subq_2.ds_month__month = subq_4.ds_month__month__complete + ) subq_5 + ) subq_6 +) subq_7 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql new file mode 100644 index 0000000000..90b981493f --- /dev/null +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_non_additive_dimension_with_non_default_grain__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join on MIN(ds_month) and [] grouping by None +-- Pass Only Elements: ['total_account_balance_first_day_of_month',] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(subq_10.total_account_balance_first_day_of_month) AS total_account_balance_first_day_of_month +FROM ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + SELECT + DATE_TRUNC('month', ds_month) AS ds_month__month + , account_balance AS total_account_balance_first_day_of_month + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_10 +INNER JOIN ( + -- Read Elements From Semantic Model 'accounts_source' + -- Metric Time Dimension 'ds_month' + -- Pass Only Elements: ['total_account_balance_first_day_of_month', 'ds_month__month'] + -- Filter row on MIN(ds_month__month) + SELECT + MIN(DATE_TRUNC('month', ds_month)) AS ds_month__month__complete + FROM ***************************.fct_accounts accounts_source_src_28000 +) subq_12 +ON + subq_10.ds_month__month = subq_12.ds_month__month__complete 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 fef8f21032..3e238cc281 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,7 +42,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -127,7 +127,7 @@ - + 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 b431d0a228..b5ca1e4635 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,7 +20,7 @@ - + @@ -46,7 +46,7 @@ - + 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 2ddfeed739..d77af7fd2e 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,7 +27,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -88,7 +88,7 @@ - + @@ -114,7 +114,7 @@ - + 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 2d63d5e1c5..3ae6ae714d 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,7 +20,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -72,7 +72,7 @@ - + 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 4964340006..7ed3cde452 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,7 +20,7 @@ - + @@ -100,7 +100,7 @@ - + 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 b071f05bc6..59767f93a5 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,7 +24,7 @@ - + @@ -50,7 +50,7 @@ - + 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 fb4c3516a7..31b945fa6f 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,7 +20,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -79,7 +79,7 @@ - + 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 14fc0c78b9..172b4c617d 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,7 +24,7 @@ - + @@ -55,7 +55,7 @@ - + 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 b9181a179d..6f1a895dcf 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,7 +32,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -113,7 +113,7 @@ - +