From ddec74e89cc55e15784335d8ea9fdd106014da61 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Wed, 13 Sep 2023 09:12:07 -0700 Subject: [PATCH] Cleanup --- .../unreleased/Features-20230911-190924.yaml | 2 +- .../dataflow/builder/dataflow_plan_builder.py | 2 +- metricflow/naming/linkable_spec_name.py | 5 +- metricflow/query/query_parser.py | 8 +- metricflow/specs/specs.py | 1 + metricflow/sql/render/big_query.py | 6 +- .../integration/test_cases/itest_metrics.yaml | 13 + .../test/integration/test_configured_cases.py | 3 + .../test_dataflow_to_sql_plan.py | 82 + metricflow/test/query/test_query_parser.py | 32 +- ...st_convert_query_semantic_model__plan0.sql | 12 +- ...le_semantic_model_with_measures__plan0.sql | 24 +- ...semantic_model_without_measures__plan0.sql | 12 +- .../test_multihop_join_plan__dfp_0.xml | 62 +- .../test_common_semantic_model__plan0.sql | 72 +- .../test_compute_metrics_node__plan0.sql | 60 +- ...o_from_multiple_semantic_models__plan0.sql | 108 +- ...atio_from_single_semantic_model__plan0.sql | 60 +- ...ompute_metrics_node_simple_expr__plan0.sql | 60 +- .../test_constrain_time_range_node__plan0.sql | 36 +- .../test_cumulative_metric__plan0.sql | 12 +- ...cumulative_metric_grain_to_date__plan0.sql | 12 +- .../test_cumulative_metric_no_ds__plan0.sql | 12 +- ...est_cumulative_metric_no_window__plan0.sql | 12 +- ..._no_window_with_time_constraint__plan0.sql | 12 +- ...ive_metric_with_time_constraint__plan0.sql | 12 +- .../BigQuery/test_derived_metric__plan0.sql | 72 +- ...ved_metric_with_offset_to_grain__plan0.sql | 72 +- ...offset_to_grain_and_granularity__plan0.sql | 72 +- ...rived_metric_with_offset_window__plan0.sql | 72 +- ...h_offset_window_and_granularity__plan0.sql | 72 +- ...fset_window_and_offset_to_grain__plan0.sql | 72 +- ...offset_to_grain_and_granularity__plan0.sql | 72 +- ...erived_offset_cumulative_metric__plan0.sql | 36 +- ...et_metric_with_one_input_metric__plan0.sql | 36 +- .../BigQuery/test_distinct_values__plan0.sql | 60 +- .../BigQuery/test_filter_node__plan0.sql | 36 +- ...lter_with_where_constraint_node__plan0.sql | 36 +- ...th_where_constraint_on_join_dim__plan0.sql | 60 +- .../test_join_to_scd_dimension__plan0.sql | 60 +- ...spine_node_with_offset_to_grain__plan0.sql | 36 +- ...e_spine_node_with_offset_window__plan0.sql | 36 +- ..._time_spine_node_without_offset__plan0.sql | 36 +- .../BigQuery/test_limit_rows__plan0.sql | 36 +- ...al_dimension_using_local_entity__plan0.sql | 24 +- .../test_measure_aggregation_node__plan0.sql | 36 +- .../test_measure_constraint__plan0.sql | 156 +- ..._constraint_with_reused_measure__plan0.sql | 72 +- ...aint_with_single_expr_and_alias__plan0.sql | 36 +- ..._multiple_sources_no_dimensions__plan0.sql | 60 +- ...multi_hop_through_scd_dimension__plan0.sql | 100 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 116 +- .../BigQuery/test_multi_join_node__plan0.sql | 84 +- .../BigQuery/test_multihop_node__plan0.sql | 76 +- ..._multiple_metrics_no_dimensions__plan0.sql | 60 +- .../test_nested_derived_metric__plan0.sql | 144 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + .../BigQuery/test_order_by_node__plan0.sql | 36 +- .../BigQuery/test_partitioned_join__plan0.sql | 60 +- .../test_semi_additive_join_node__plan0.sql | 24 +- ...mi_additive_join_node__plan0_optimized.sql | 12 +- ...dditive_join_node_with_grouping__plan0.sql | 24 +- ...in_node_with_grouping__plan0_optimized.sql | 12 +- ...join_node_with_queried_group_by__plan0.sql | 24 +- ...with_queried_group_by__plan0_optimized.sql | 12 +- ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + .../BigQuery/test_single_join_node__plan0.sql | 60 +- .../BigQuery/test_source_node__plan0.sql | 36 +- .../test_source_node__plan0_optimized.sql | 36 +- ...multi_hop_through_scd_dimension__plan0.sql | 28 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 56 +- .../Databricks/test_multihop_node__plan0.sql | 28 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + ...multi_hop_through_scd_dimension__plan0.sql | 28 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 56 +- .../DuckDB/test_multihop_node__plan0.sql | 28 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + ...multi_hop_through_scd_dimension__plan0.sql | 28 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 56 +- .../Postgres/test_multihop_node__plan0.sql | 28 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + ...multi_hop_through_scd_dimension__plan0.sql | 28 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 56 +- .../Redshift/test_multihop_node__plan0.sql | 28 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + ...multi_hop_through_scd_dimension__plan0.sql | 28 +- ...test_multi_hop_to_scd_dimension__plan0.sql | 56 +- .../Snowflake/test_multihop_node__plan0.sql | 28 +- ...st_offset_window_with_date_part__plan0.sql | 585 +++++ ...window_with_date_part__plan0_optimized.sql | 63 + ...est_simple_query_with_date_part__plan0.sql | 227 ++ ..._query_with_date_part__plan0_optimized.sql | 17 + ..._query_with_multiple_date_parts__plan0.sql | 258 ++ ...h_multiple_date_parts__plan0_optimized.sql | 42 + ...multi_hop_through_scd_dimension__plan0.xml | 58 +- ...test_multi_hop_to_scd_dimension__plan0.xml | 106 +- .../test_multihop_node__plan0.xml | 62 +- ...st_offset_window_with_date_part__plan0.xml | 2165 +++++++++++++++++ ...est_simple_query_with_date_part__plan0.xml | 863 +++++++ ..._query_with_multiple_date_parts__plan0.xml | 966 ++++++++ ...orm_node_using_non_primary_time__plan0.sql | 36 +- ...sing_non_primary_time__plan0_optimized.sql | 42 +- ...ansform_node_using_primary_time__plan0.sql | 36 +- ...de_using_primary_time__plan0_optimized.sql | 42 +- ...uery_with_metric_time_dimension__plan0.sql | 72 +- .../test_joined_node_data_set__result0.txt | 42 +- 130 files changed, 13237 insertions(+), 1969 deletions(-) create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml create mode 100644 metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml diff --git a/.changes/unreleased/Features-20230911-190924.yaml b/.changes/unreleased/Features-20230911-190924.yaml index 8370049390..85d9d36c35 100644 --- a/.changes/unreleased/Features-20230911-190924.yaml +++ b/.changes/unreleased/Features-20230911-190924.yaml @@ -1,5 +1,5 @@ kind: Features -body: DatePart aggregation for time dimensions +body: Enable DATE PART aggregation for time dimensions time: 2023-09-11T19:09:24.960342-07:00 custom: Author: courtneyholcomb diff --git a/metricflow/dataflow/builder/dataflow_plan_builder.py b/metricflow/dataflow/builder/dataflow_plan_builder.py index c989d43131..1445c7918f 100644 --- a/metricflow/dataflow/builder/dataflow_plan_builder.py +++ b/metricflow/dataflow/builder/dataflow_plan_builder.py @@ -792,7 +792,7 @@ def _build_aggregated_measures_from_measure_source_node( # If querying an offset metric, join to time spine. join_to_time_spine_node: Optional[JoinToTimeSpineNode] = None if metric_spec.offset_window or metric_spec.offset_to_grain: - assert metric_time_dimension_specs, "Joining to time spine requires querying with metric_time." + assert metric_time_dimension_specs, "Joining to time spine requires querying with metric time." join_to_time_spine_node = JoinToTimeSpineNode( parent_node=time_range_node or measure_recipe.measure_node, metric_time_dimension_specs=metric_time_dimension_specs, diff --git a/metricflow/naming/linkable_spec_name.py b/metricflow/naming/linkable_spec_name.py index 0e73415cd4..3a886b7faf 100644 --- a/metricflow/naming/linkable_spec_name.py +++ b/metricflow/naming/linkable_spec_name.py @@ -63,7 +63,10 @@ def from_name(qualified_name: str) -> StructuredLinkableSpecName: @property def qualified_name(self) -> str: - """Return the full name form. e.g. ds or listing__ds__month.""" + """Return the full name form. e.g. ds or listing__ds__month. + + If date_part is specified, don't include granularity in qualified_name since it will not impact the result. + """ items = list(self.entity_link_names) + [self.element_name] if self.date_part: items.append(self.date_part_suffix(date_part=self.date_part)) diff --git a/metricflow/query/query_parser.py b/metricflow/query/query_parser.py index b220239631..3cf160a559 100644 --- a/metricflow/query/query_parser.py +++ b/metricflow/query/query_parser.py @@ -702,7 +702,9 @@ def _parse_linkable_elements( for linkable_element in linkable_elements: parsed_name = StructuredLinkableSpecName.from_name(linkable_element.name) if parsed_name.time_granularity: - raise ValueError("Time granularity must be passed in the grain attribute for group_by query param.") + raise ValueError( + "Time granularity must be passed in the `grain` attribute for `group_by` query param." + ) structured_name = StructuredLinkableSpecName( entity_link_names=parsed_name.entity_link_names, element_name=parsed_name.element_name, @@ -721,15 +723,15 @@ def _parse_linkable_elements( entity_links = tuple(EntityReference(element_name=x) for x in structured_name.entity_link_names) # Create the spec based on the type of element referenced. if TimeDimensionReference(element_name=element_name) in self._known_time_dimension_element_references: - if structured_name.time_granularity: + if structured_name.time_granularity and not structured_name.date_part: time_dimension_specs.append( TimeDimensionSpec( element_name=element_name, entity_links=entity_links, time_granularity=structured_name.time_granularity, - date_part=structured_name.date_part, ) ) + # If date part is passed, remove requested granularity (to be overridden with default). else: partial_time_dimension_specs.append( PartialTimeDimensionSpec( diff --git a/metricflow/specs/specs.py b/metricflow/specs/specs.py index f065c0d693..81e1f68e23 100644 --- a/metricflow/specs/specs.py +++ b/metricflow/specs/specs.py @@ -327,6 +327,7 @@ def qualified_name(self) -> str: # noqa: D entity_link_names=tuple(x.element_name for x in self.entity_links), element_name=self.element_name, time_granularity=self.time_granularity, + date_part=self.date_part, ).qualified_name @property diff --git a/metricflow/sql/render/big_query.py b/metricflow/sql/render/big_query.py index 9b55c6a28d..4dcb42aaa3 100644 --- a/metricflow/sql/render/big_query.py +++ b/metricflow/sql/render/big_query.py @@ -133,11 +133,11 @@ def visit_date_trunc_expr(self, node: SqlDateTruncExpression) -> SqlExpressionRe @override def render_date_part(self, date_part: DatePart) -> str: if date_part == DatePart.DOY: - return "DAYOFYEAR" + return "dayofyear" if date_part == DatePart.DOW: - return "DAYOFWEEK" + return "dayofweek" if date_part == DatePart.WEEK: - return "ISOWEEK" + return "isoweek" return super().render_date_part(date_part) diff --git a/metricflow/test/integration/test_cases/itest_metrics.yaml b/metricflow/test/integration/test_cases/itest_metrics.yaml index 20c0f302d4..bc3b0ec79e 100644 --- a/metricflow/test/integration/test_cases/itest_metrics.yaml +++ b/metricflow/test/integration/test_cases/itest_metrics.yaml @@ -1104,3 +1104,16 @@ integration_test: ) b ON {{ render_date_sub("a", "ds", 5, TimeGranularity.DAY) }} = b.metric_time__day GROUP BY metric_time__extract_month +--- +integration_test: + name: date_part_overrides_granularity + description: Test query using date_part with incompatible granularity; should override granularity + model: SIMPLE_MODEL + metrics: ["bookings"] + group_by_objs: [{"name": "metric_time", "grain": "month", "date_part": "dow"}] + check_query: | + SELECT + SUM(1) AS bookings + , {{ render_extract("ds", DatePart.DOW) }} AS metric_time__extract_dow + FROM {{ source_schema }}.fct_bookings + GROUP BY {{ render_extract("ds", DatePart.DOW) }}; diff --git a/metricflow/test/integration/test_configured_cases.py b/metricflow/test/integration/test_configured_cases.py index 46dd07e2a3..28bfc0112c 100644 --- a/metricflow/test/integration/test_configured_cases.py +++ b/metricflow/test/integration/test_configured_cases.py @@ -259,8 +259,11 @@ def test_case( for group_by_kwargs in case.group_by_objs: kwargs = copy(group_by_kwargs) date_part = kwargs.get("date_part") + grain = kwargs.get("grain") if date_part: kwargs["date_part"] = DatePart(date_part) + if grain: + kwargs["grain"] = TimeGranularity(grain) group_by.append(MockQueryParameter(**kwargs)) query_result = engine.query( MetricFlowQueryRequest.create_with_random_request_id( diff --git a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py index 0bb3ded01d..a09a5efe73 100644 --- a/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py +++ b/metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py @@ -57,6 +57,7 @@ from metricflow.test.snapshot_utils import assert_plan_snapshot_text_equal from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_from_plan_equal, assert_sql_plan_text_equal from metricflow.test.time.metric_time_dimension import MTD_SPEC_DAY, MTD_SPEC_QUARTER, MTD_SPEC_WEEK, MTD_SPEC_YEAR +from metricflow.time.date_part import DatePart @pytest.fixture(scope="session") @@ -1858,3 +1859,84 @@ def test_derived_offset_cumulative_metric( # noqa: D sql_client=sql_client, node=dataflow_plan.sink_output_nodes[0].parent_node, ) + + +def test_simple_query_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder[SemanticModelDataSet], + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter[SemanticModelDataSet], + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +def test_simple_query_with_multiple_date_parts( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder[SemanticModelDataSet], + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter[SemanticModelDataSet], + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER), + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) + + +def test_offset_window_with_date_part( # noqa: D + request: FixtureRequest, + mf_test_session_state: MetricFlowTestSessionState, + dataflow_plan_builder: DataflowPlanBuilder[SemanticModelDataSet], + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter[SemanticModelDataSet], + sql_client: SqlClient, +) -> None: + dataflow_plan = dataflow_plan_builder.build_plan( + MetricFlowQuerySpec( + metric_specs=(MetricSpec(element_name="bookings_growth_2_weeks"),), + time_dimension_specs=( + DataSet.metric_time_dimension_spec(time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW), + ), + ) + ) + + convert_and_check( + request=request, + mf_test_session_state=mf_test_session_state, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + node=dataflow_plan.sink_output_nodes[0].parent_node, + ) diff --git a/metricflow/test/query/test_query_parser.py b/metricflow/test/query/test_query_parser.py index 2bba217baf..b1926067b7 100644 --- a/metricflow/test/query/test_query_parser.py +++ b/metricflow/test/query/test_query_parser.py @@ -136,6 +136,18 @@ - name: revenue offset_window: 14 days alias: revenue_2_weeks_ago + --- + metric: + name: revenue_since_start_of_year + description: Revenue since start of year + type: derived + type_params: + expr: revenue - revenue_start_of_year + metrics: + - name: revenue + - name: revenue + offset_to_grain: year + alias: revenue_start_of_year """ ) @@ -405,13 +417,6 @@ def test_date_part_parsing() -> None: group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.DOW)], ) - # Date part is incompatible with the requested time granularity for the same time dimension - with pytest.raises(RequestTimeGranularityException): - query_parser.parse_and_validate_query( - metric_names=["revenue"], - group_by=[MockQueryParameter(name="metric_time", grain=TimeGranularity.YEAR, date_part=DatePart.MONTH)], - ) - # Can't query date part for cumulative metrics with pytest.raises(UnableToSatisfyQueryError): query_parser.parse_and_validate_query( @@ -419,8 +424,21 @@ def test_date_part_parsing() -> None: group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.DOY)], ) + # Can't query date part for metrics with offset to grain + with pytest.raises(UnableToSatisfyQueryError): + query_parser.parse_and_validate_query( + metric_names=["revenue_since_start_of_year"], + group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.DAY)], + ) + # Date part is compatible query_parser.parse_and_validate_query( metric_names=["revenue"], group_by=[MockQueryParameter(name="metric_time", date_part=DatePart.MONTH)], ) + + # Incompatible granularity gets overriden + query_parser.parse_and_validate_query( + metric_names=["revenue"], + group_by=[MockQueryParameter(name="metric_time", grain=TimeGranularity.YEAR, date_part=DatePart.MONTH)], + ) diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql index f00e2be64e..95c23db647 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql @@ -9,10 +9,10 @@ SELECT , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -21,10 +21,10 @@ SELECT , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql index b6a752aa1c..21f374f1fe 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql @@ -9,10 +9,10 @@ SELECT , EXTRACT(year FROM id_verifications_src_10003.ds) AS ds__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds) AS ds__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds) AS ds__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS ds__extract_doy , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS ds_partitioned__month @@ -21,10 +21,10 @@ SELECT , EXTRACT(year FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC(id_verifications_src_10003.ds, isoweek) AS verification__ds__week @@ -34,10 +34,10 @@ SELECT , EXTRACT(year FROM id_verifications_src_10003.ds) AS verification__ds__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds) AS verification__ds__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds) AS verification__ds__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds) AS verification__ds__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS verification__ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS verification__ds_partitioned__month @@ -46,10 +46,10 @@ SELECT , EXTRACT(year FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql index c698caae42..abec542070 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql @@ -8,10 +8,10 @@ SELECT , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM users_latest_src_10008.ds) AS ds__extract_week + , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS ds__extract_week , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS ds__extract_doy , users_latest_src_10008.home_state_latest , users_latest_src_10008.ds AS user__ds__day , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS user__ds__week @@ -21,10 +21,10 @@ SELECT , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(ISOWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_week + , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS user__ds__extract_week , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS user__ds__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml index 4b1abcc4e0..108556d708 100644 --- a/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml +++ b/metricflow/test/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml @@ -138,37 +138,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql index 8d272a50fc..eda032ff2f 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_common_semantic_model__plan0.sql @@ -153,10 +153,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -165,10 +165,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -177,10 +177,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -190,10 +190,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -202,10 +202,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -214,10 +214,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -382,10 +382,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -394,10 +394,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -406,10 +406,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -419,10 +419,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -431,10 +431,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -443,10 +443,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql index fdcc14c145..ed7c79b643 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql @@ -47,10 +47,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -59,10 +59,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -71,10 +71,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -84,10 +84,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -96,10 +96,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -108,10 +108,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -141,10 +141,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -153,10 +153,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -168,10 +168,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -180,10 +180,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index a0d4381867..178465c7ed 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -177,10 +177,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -189,10 +189,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -201,10 +201,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -214,10 +214,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -226,10 +226,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -238,10 +238,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -347,10 +347,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -359,10 +359,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -374,10 +374,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -386,10 +386,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -522,10 +522,10 @@ FROM ( , EXTRACT(year FROM views_source_src_10009.ds) AS ds__extract_year , EXTRACT(quarter FROM views_source_src_10009.ds) AS ds__extract_quarter , EXTRACT(month FROM views_source_src_10009.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM views_source_src_10009.ds) AS ds__extract_week + , EXTRACT(isoweek FROM views_source_src_10009.ds) AS ds__extract_week , EXTRACT(day FROM views_source_src_10009.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM views_source_src_10009.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds) AS ds__extract_doy , views_source_src_10009.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(views_source_src_10009.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(views_source_src_10009.ds_partitioned, month) AS ds_partitioned__month @@ -534,10 +534,10 @@ FROM ( , EXTRACT(year FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds_partitioned) AS ds_partitioned__extract_doy , views_source_src_10009.ds AS view__ds__day , DATE_TRUNC(views_source_src_10009.ds, isoweek) AS view__ds__week , DATE_TRUNC(views_source_src_10009.ds, month) AS view__ds__month @@ -546,10 +546,10 @@ FROM ( , EXTRACT(year FROM views_source_src_10009.ds) AS view__ds__extract_year , EXTRACT(quarter FROM views_source_src_10009.ds) AS view__ds__extract_quarter , EXTRACT(month FROM views_source_src_10009.ds) AS view__ds__extract_month - , EXTRACT(ISOWEEK FROM views_source_src_10009.ds) AS view__ds__extract_week + , EXTRACT(isoweek FROM views_source_src_10009.ds) AS view__ds__extract_week , EXTRACT(day FROM views_source_src_10009.ds) AS view__ds__extract_day - , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds) AS view__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds) AS view__ds__extract_doy + , EXTRACT(dayofweek FROM views_source_src_10009.ds) AS view__ds__extract_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds) AS view__ds__extract_doy , views_source_src_10009.ds_partitioned AS view__ds_partitioned__day , DATE_TRUNC(views_source_src_10009.ds_partitioned, isoweek) AS view__ds_partitioned__week , DATE_TRUNC(views_source_src_10009.ds_partitioned, month) AS view__ds_partitioned__month @@ -558,10 +558,10 @@ FROM ( , EXTRACT(year FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_year , EXTRACT(quarter FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_quarter , EXTRACT(month FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week + , EXTRACT(isoweek FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_week , EXTRACT(day FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM views_source_src_10009.ds_partitioned) AS view__ds_partitioned__extract_doy , views_source_src_10009.listing_id AS listing , views_source_src_10009.user_id AS user , views_source_src_10009.listing_id AS view__listing @@ -665,10 +665,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -677,10 +677,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -692,10 +692,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -704,10 +704,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index ad59db3e71..8969f7a6c0 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -50,10 +50,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -62,10 +62,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -74,10 +74,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -87,10 +87,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -99,10 +99,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -111,10 +111,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -144,10 +144,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -156,10 +156,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -171,10 +171,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -183,10 +183,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql index 4d1af3e704..1ddd22d435 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql @@ -47,10 +47,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -59,10 +59,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -71,10 +71,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -84,10 +84,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -96,10 +96,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -108,10 +108,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -141,10 +141,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -153,10 +153,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -168,10 +168,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -180,10 +180,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql index 539cd1c2ea..7e50393d6d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql @@ -41,10 +41,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -53,10 +53,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -65,10 +65,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -78,10 +78,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -90,10 +90,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -102,10 +102,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql index c60a8f1013..bd9b392402 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql @@ -67,10 +67,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -79,10 +79,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql index c2e7e2ba3a..639e816eb6 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql @@ -67,10 +67,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -79,10 +79,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql index 5690d18f05..cd58d0ce0d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql @@ -64,10 +64,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -76,10 +76,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql index 958cb5faa4..35cc71b613 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql @@ -67,10 +67,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -79,10 +79,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql index 431635cda5..829e30ded9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -109,10 +109,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -121,10 +121,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql index f16e293fe0..c8630b8f49 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql @@ -109,10 +109,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS ds__extract_doy , revenue_src_10006.created_at AS company__ds__day , DATE_TRUNC(revenue_src_10006.created_at, isoweek) AS company__ds__week , DATE_TRUNC(revenue_src_10006.created_at, month) AS company__ds__month @@ -121,10 +121,10 @@ FROM ( , EXTRACT(year FROM revenue_src_10006.created_at) AS company__ds__extract_year , EXTRACT(quarter FROM revenue_src_10006.created_at) AS company__ds__extract_quarter , EXTRACT(month FROM revenue_src_10006.created_at) AS company__ds__extract_month - , EXTRACT(ISOWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_week + , EXTRACT(isoweek FROM revenue_src_10006.created_at) AS company__ds__extract_week , EXTRACT(day FROM revenue_src_10006.created_at) AS company__ds__extract_day - , EXTRACT(DAYOFWEEK FROM revenue_src_10006.created_at) AS company__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM revenue_src_10006.created_at) AS company__ds__extract_doy + , EXTRACT(dayofweek FROM revenue_src_10006.created_at) AS company__ds__extract_dow + , EXTRACT(dayofyear FROM revenue_src_10006.created_at) AS company__ds__extract_doy , revenue_src_10006.user_id AS user , revenue_src_10006.user_id AS company__user FROM ***************************.fct_revenue revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql index 2982019f1d..ffc899b824 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql @@ -158,10 +158,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -387,10 +387,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -399,10 +399,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -411,10 +411,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -424,10 +424,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -436,10 +436,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -448,10 +448,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql index 9b40278672..2705007543 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql @@ -158,10 +158,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -490,10 +490,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -502,10 +502,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -514,10 +514,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -527,10 +527,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -539,10 +539,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -551,10 +551,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 2ab4211e28..7d7c920907 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -158,10 +158,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -490,10 +490,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -502,10 +502,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -514,10 +514,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -527,10 +527,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -539,10 +539,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -551,10 +551,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql index b344f149a4..62768ac034 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql @@ -158,10 +158,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -490,10 +490,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -502,10 +502,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -514,10 +514,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -527,10 +527,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -539,10 +539,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -551,10 +551,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 8028b1f148..229acaf841 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -158,10 +158,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -490,10 +490,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -502,10 +502,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -514,10 +514,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -527,10 +527,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -539,10 +539,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -551,10 +551,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 64d1c8125b..a4c8b503e4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -261,10 +261,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -273,10 +273,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -285,10 +285,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -298,10 +298,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -310,10 +310,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -322,10 +322,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -596,10 +596,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -608,10 +608,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -620,10 +620,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -633,10 +633,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -645,10 +645,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -657,10 +657,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 3bf4e0e3cd..9107fdbe8a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -261,10 +261,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -273,10 +273,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -285,10 +285,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -298,10 +298,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -310,10 +310,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -322,10 +322,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -597,10 +597,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -609,10 +609,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -621,10 +621,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -634,10 +634,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -646,10 +646,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -658,10 +658,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql index b6f236cde8..0d9742944b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql @@ -369,10 +369,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -381,10 +381,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -393,10 +393,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -406,10 +406,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -418,10 +418,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -430,10 +430,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql index 4d754919c2..13415b0ae2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -255,10 +255,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -267,10 +267,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -279,10 +279,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -292,10 +292,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -304,10 +304,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -316,10 +316,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql index 9373149736..5c0e215038 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_distinct_values__plan0.sql @@ -168,10 +168,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -180,10 +180,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -192,10 +192,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -205,10 +205,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -217,10 +217,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -229,10 +229,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -338,10 +338,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -350,10 +350,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -365,10 +365,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -377,10 +377,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql index 84160306fc..12f6f6e38a 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql @@ -28,10 +28,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -40,10 +40,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -52,10 +52,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -65,10 +65,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -77,10 +77,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -89,10 +89,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql index 74d3cae54a..d13bb8fafe 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql @@ -34,10 +34,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -46,10 +46,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -71,10 +71,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -83,10 +83,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -95,10 +95,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql index 0352822f08..a4205ece06 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -174,10 +174,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -186,10 +186,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -198,10 +198,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -211,10 +211,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -223,10 +223,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -235,10 +235,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -344,10 +344,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -356,10 +356,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -371,10 +371,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -383,10 +383,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql index 1ebeb96fdf..1d933aaf04 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_scd_dimension__plan0.sql @@ -162,10 +162,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month @@ -174,10 +174,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month @@ -186,10 +186,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week @@ -199,10 +199,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month @@ -211,10 +211,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month @@ -223,10 +223,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -258,10 +258,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_from) AS window_start__extract_year , EXTRACT(quarter FROM listings_src_10017.active_from) AS window_start__extract_quarter , EXTRACT(month FROM listings_src_10017.active_from) AS window_start__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_from) AS window_start__extract_week , EXTRACT(day FROM listings_src_10017.active_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS window_start__extract_doy , listings_src_10017.active_to AS window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS window_end__month @@ -270,10 +270,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_to) AS window_end__extract_year , EXTRACT(quarter FROM listings_src_10017.active_to) AS window_end__extract_quarter , EXTRACT(month FROM listings_src_10017.active_to) AS window_end__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_to) AS window_end__extract_week , EXTRACT(day FROM listings_src_10017.active_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -285,10 +285,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_from) AS listing__window_start__extract_year , EXTRACT(quarter FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter , EXTRACT(month FROM listings_src_10017.active_from) AS listing__window_start__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_from) AS listing__window_start__extract_week , EXTRACT(day FROM listings_src_10017.active_from) AS listing__window_start__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS listing__window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS listing__window_end__month @@ -297,10 +297,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_to) AS listing__window_end__extract_year , EXTRACT(quarter FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter , EXTRACT(month FROM listings_src_10017.active_to) AS listing__window_end__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_to) AS listing__window_end__extract_week , EXTRACT(day FROM listings_src_10017.active_to) AS listing__window_end__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql index f40b5933ab..fd5aaaa276 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql @@ -163,10 +163,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -175,10 +175,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -187,10 +187,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -200,10 +200,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -212,10 +212,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -224,10 +224,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql index bdb3b55b6b..438ffdddad 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql @@ -163,10 +163,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -175,10 +175,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -187,10 +187,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -200,10 +200,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -212,10 +212,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -224,10 +224,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql index f0523526b9..919c372968 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql @@ -163,10 +163,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -175,10 +175,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -187,10 +187,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -200,10 +200,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -212,10 +212,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -224,10 +224,10 @@ INNER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql index 8aac1294f0..9bedbf14e2 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_limit_rows__plan0.sql @@ -152,10 +152,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -164,10 +164,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -176,10 +176,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -189,10 +189,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -201,10 +201,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -213,10 +213,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql index bc42027f9e..5ee683c896 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_local_dimension_using_local_entity__plan0.sql @@ -102,10 +102,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -114,10 +114,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -129,10 +129,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -141,10 +141,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql index 7cffe26a94..ff2afccd69 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql @@ -38,10 +38,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -50,10 +50,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -62,10 +62,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -75,10 +75,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -87,10 +87,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -99,10 +99,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql index 451625b47c..77cede8ad4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint__plan0.sql @@ -186,10 +186,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -198,10 +198,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -210,10 +210,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -223,10 +223,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -235,10 +235,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -247,10 +247,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -356,10 +356,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -368,10 +368,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -383,10 +383,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -395,10 +395,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -597,10 +597,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -609,10 +609,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -621,10 +621,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -634,10 +634,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -646,10 +646,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -658,10 +658,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -767,10 +767,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -779,10 +779,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -794,10 +794,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -806,10 +806,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -991,10 +991,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -1003,10 +1003,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -1015,10 +1015,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -1028,10 +1028,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -1040,10 +1040,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -1052,10 +1052,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql index 74ac44eb4b..2431233751 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_reused_measure__plan0.sql @@ -171,10 +171,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -183,10 +183,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -195,10 +195,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -208,10 +208,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -220,10 +220,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -232,10 +232,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -403,10 +403,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -415,10 +415,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -427,10 +427,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -440,10 +440,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -452,10 +452,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -464,10 +464,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql index 6afff7eaab..c9052ccd01 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -165,10 +165,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -177,10 +177,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -189,10 +189,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -202,10 +202,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -214,10 +214,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -226,10 +226,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql index e0d87aa819..78bc20baf3 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_metric_with_measures_from_multiple_sources_no_dimensions__plan0.sql @@ -153,10 +153,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -165,10 +165,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -177,10 +177,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -190,10 +190,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -202,10 +202,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -214,10 +214,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -332,10 +332,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -344,10 +344,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -359,10 +359,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -371,10 +371,10 @@ FROM ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql index ba0780ad72..fa17fe59fa 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_through_scd_dimension__plan0.sql @@ -152,10 +152,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month @@ -164,10 +164,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month @@ -176,10 +176,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week @@ -189,10 +189,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month @@ -201,10 +201,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month @@ -213,10 +213,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -321,10 +321,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_from) AS window_start__extract_year , EXTRACT(quarter FROM listings_src_10017.active_from) AS window_start__extract_quarter , EXTRACT(month FROM listings_src_10017.active_from) AS window_start__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_from) AS window_start__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_from) AS window_start__extract_week , EXTRACT(day FROM listings_src_10017.active_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS window_start__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_from) AS window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS window_start__extract_doy , listings_src_10017.active_to AS window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS window_end__month @@ -333,10 +333,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_to) AS window_end__extract_year , EXTRACT(quarter FROM listings_src_10017.active_to) AS window_end__extract_quarter , EXTRACT(month FROM listings_src_10017.active_to) AS window_end__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_to) AS window_end__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_to) AS window_end__extract_week , EXTRACT(day FROM listings_src_10017.active_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS window_end__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_to) AS window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS window_end__extract_doy , listings_src_10017.country , listings_src_10017.is_lux , listings_src_10017.capacity @@ -348,10 +348,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_from) AS listing__window_start__extract_year , EXTRACT(quarter FROM listings_src_10017.active_from) AS listing__window_start__extract_quarter , EXTRACT(month FROM listings_src_10017.active_from) AS listing__window_start__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_from) AS listing__window_start__extract_week , EXTRACT(day FROM listings_src_10017.active_from) AS listing__window_start__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_from) AS listing__window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_from) AS listing__window_start__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_from) AS listing__window_start__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_from) AS listing__window_start__extract_doy , listings_src_10017.active_to AS listing__window_end__day , DATE_TRUNC(listings_src_10017.active_to, isoweek) AS listing__window_end__week , DATE_TRUNC(listings_src_10017.active_to, month) AS listing__window_end__month @@ -360,10 +360,10 @@ FROM ( , EXTRACT(year FROM listings_src_10017.active_to) AS listing__window_end__extract_year , EXTRACT(quarter FROM listings_src_10017.active_to) AS listing__window_end__extract_quarter , EXTRACT(month FROM listings_src_10017.active_to) AS listing__window_end__extract_month - , EXTRACT(ISOWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_week + , EXTRACT(isoweek FROM listings_src_10017.active_to) AS listing__window_end__extract_week , EXTRACT(day FROM listings_src_10017.active_to) AS listing__window_end__extract_day - , EXTRACT(DAYOFWEEK FROM listings_src_10017.active_to) AS listing__window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_src_10017.active_to) AS listing__window_end__extract_doy + , EXTRACT(dayofweek FROM listings_src_10017.active_to) AS listing__window_end__extract_dow + , EXTRACT(dayofyear FROM listings_src_10017.active_to) AS listing__window_end__extract_doy , listings_src_10017.country AS listing__country , listings_src_10017.is_lux AS listing__is_lux , listings_src_10017.capacity AS listing__capacity @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day @@ -440,10 +440,10 @@ FROM ( , EXTRACT(year FROM users_latest_src_10021.ds) AS ds__extract_year , EXTRACT(quarter FROM users_latest_src_10021.ds) AS ds__extract_quarter , EXTRACT(month FROM users_latest_src_10021.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM users_latest_src_10021.ds) AS ds__extract_week + , EXTRACT(isoweek FROM users_latest_src_10021.ds) AS ds__extract_week , EXTRACT(day FROM users_latest_src_10021.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM users_latest_src_10021.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10021.ds) AS ds__extract_doy , users_latest_src_10021.home_state_latest , users_latest_src_10021.ds AS user__ds__day , DATE_TRUNC(users_latest_src_10021.ds, isoweek) AS user__ds__week @@ -453,10 +453,10 @@ FROM ( , EXTRACT(year FROM users_latest_src_10021.ds) AS user__ds__extract_year , EXTRACT(quarter FROM users_latest_src_10021.ds) AS user__ds__extract_quarter , EXTRACT(month FROM users_latest_src_10021.ds) AS user__ds__extract_month - , EXTRACT(ISOWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_week + , EXTRACT(isoweek FROM users_latest_src_10021.ds) AS user__ds__extract_week , EXTRACT(day FROM users_latest_src_10021.ds) AS user__ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_latest_src_10021.ds) AS user__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_latest_src_10021.ds) AS user__ds__extract_doy + , EXTRACT(dayofweek FROM users_latest_src_10021.ds) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10021.ds) AS user__ds__extract_doy , users_latest_src_10021.home_state_latest AS user__home_state_latest , users_latest_src_10021.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10021 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql index 62d24b00ba..eb008dd112 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_hop_to_scd_dimension__plan0.sql @@ -152,10 +152,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS ds__extract_doy , bookings_source_src_10015.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS ds_partitioned__month @@ -164,10 +164,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS paid_at__month @@ -176,10 +176,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS paid_at__extract_doy , bookings_source_src_10015.is_instant AS booking__is_instant , bookings_source_src_10015.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10015.ds, isoweek) AS booking__ds__week @@ -189,10 +189,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds) AS booking__ds__extract_doy , bookings_source_src_10015.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10015.ds_partitioned, month) AS booking__ds_partitioned__month @@ -201,10 +201,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10015.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10015.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10015.paid_at, month) AS booking__paid_at__month @@ -213,10 +213,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10015.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10015.listing_id AS listing , bookings_source_src_10015.guest_id AS guest , bookings_source_src_10015.host_id AS host @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day @@ -395,10 +395,10 @@ FROM ( , EXTRACT(year FROM lux_listings_src_10019.valid_from) AS window_start__extract_year , EXTRACT(quarter FROM lux_listings_src_10019.valid_from) AS window_start__extract_quarter , EXTRACT(month FROM lux_listings_src_10019.valid_from) AS window_start__extract_month - , EXTRACT(ISOWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_week + , EXTRACT(isoweek FROM lux_listings_src_10019.valid_from) AS window_start__extract_week , EXTRACT(day FROM lux_listings_src_10019.valid_from) AS window_start__extract_day - , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy + , EXTRACT(dayofweek FROM lux_listings_src_10019.valid_from) AS window_start__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_from) AS window_start__extract_doy , lux_listings_src_10019.valid_to AS window_end__day , DATE_TRUNC(lux_listings_src_10019.valid_to, isoweek) AS window_end__week , DATE_TRUNC(lux_listings_src_10019.valid_to, month) AS window_end__month @@ -407,10 +407,10 @@ FROM ( , EXTRACT(year FROM lux_listings_src_10019.valid_to) AS window_end__extract_year , EXTRACT(quarter FROM lux_listings_src_10019.valid_to) AS window_end__extract_quarter , EXTRACT(month FROM lux_listings_src_10019.valid_to) AS window_end__extract_month - , EXTRACT(ISOWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_week + , EXTRACT(isoweek FROM lux_listings_src_10019.valid_to) AS window_end__extract_week , EXTRACT(day FROM lux_listings_src_10019.valid_to) AS window_end__extract_day - , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy + , EXTRACT(dayofweek FROM lux_listings_src_10019.valid_to) AS window_end__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_to) AS window_end__extract_doy , lux_listings_src_10019.is_confirmed_lux , lux_listings_src_10019.valid_from AS lux_listing__window_start__day , DATE_TRUNC(lux_listings_src_10019.valid_from, isoweek) AS lux_listing__window_start__week @@ -420,10 +420,10 @@ FROM ( , EXTRACT(year FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_year , EXTRACT(quarter FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_quarter , EXTRACT(month FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_month - , EXTRACT(ISOWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week + , EXTRACT(isoweek FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_week , EXTRACT(day FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_day - , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow - , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy + , EXTRACT(dayofweek FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_from) AS lux_listing__window_start__extract_doy , lux_listings_src_10019.valid_to AS lux_listing__window_end__day , DATE_TRUNC(lux_listings_src_10019.valid_to, isoweek) AS lux_listing__window_end__week , DATE_TRUNC(lux_listings_src_10019.valid_to, month) AS lux_listing__window_end__month @@ -432,10 +432,10 @@ FROM ( , EXTRACT(year FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_year , EXTRACT(quarter FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_quarter , EXTRACT(month FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_month - , EXTRACT(ISOWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week + , EXTRACT(isoweek FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_week , EXTRACT(day FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_day - , EXTRACT(DAYOFWEEK FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow - , EXTRACT(DAYOFYEAR FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy + , EXTRACT(dayofweek FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_dow + , EXTRACT(dayofyear FROM lux_listings_src_10019.valid_to) AS lux_listing__window_end__extract_doy , lux_listings_src_10019.is_confirmed_lux AS lux_listing__is_confirmed_lux , lux_listings_src_10019.lux_listing_id AS lux_listing FROM ***************************.dim_lux_listings lux_listings_src_10019 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql index 0b80e4d74f..7896f7776d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql @@ -36,10 +36,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -48,10 +48,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -60,10 +60,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -73,10 +73,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -85,10 +85,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -97,10 +97,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -130,10 +130,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -142,10 +142,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -157,10 +157,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -169,10 +169,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest @@ -204,10 +204,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -216,10 +216,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -231,10 +231,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -243,10 +243,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql index 7e7b3ab4ea..59e26e6b2d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql @@ -107,10 +107,10 @@ FROM ( , EXTRACT(year FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__extract_doy , account_month_txns_src_10010.ds AS ds__day , DATE_TRUNC(account_month_txns_src_10010.ds, isoweek) AS ds__week , DATE_TRUNC(account_month_txns_src_10010.ds, month) AS ds__month @@ -119,10 +119,10 @@ FROM ( , EXTRACT(year FROM account_month_txns_src_10010.ds) AS ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_10010.ds) AS ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_10010.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_week + , EXTRACT(isoweek FROM account_month_txns_src_10010.ds) AS ds__extract_week , EXTRACT(day FROM account_month_txns_src_10010.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM account_month_txns_src_10010.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds) AS ds__extract_doy , account_month_txns_src_10010.account_month , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC(account_month_txns_src_10010.ds_partitioned, isoweek) AS account_id__ds_partitioned__week @@ -132,10 +132,10 @@ FROM ( , EXTRACT(year FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(isoweek FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_week , EXTRACT(day FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__extract_doy , account_month_txns_src_10010.ds AS account_id__ds__day , DATE_TRUNC(account_month_txns_src_10010.ds, isoweek) AS account_id__ds__week , DATE_TRUNC(account_month_txns_src_10010.ds, month) AS account_id__ds__month @@ -144,10 +144,10 @@ FROM ( , EXTRACT(year FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_year , EXTRACT(quarter FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_quarter , EXTRACT(month FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_month - , EXTRACT(ISOWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week + , EXTRACT(isoweek FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_week , EXTRACT(day FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_day - , EXTRACT(DAYOFWEEK FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy + , EXTRACT(dayofweek FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_dow + , EXTRACT(dayofyear FROM account_month_txns_src_10010.ds) AS account_id__ds__extract_doy , account_month_txns_src_10010.account_month AS account_id__account_month , account_month_txns_src_10010.account_id FROM ***************************.account_month_txns account_month_txns_src_10010 @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS ds_partitioned__extract_doy , bridge_table_src_10011.extra_dim AS account_id__extra_dim , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned__day , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, isoweek) AS account_id__ds_partitioned__week @@ -232,10 +232,10 @@ FROM ( , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_year , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_quarter , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_week , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day @@ -315,10 +315,10 @@ FROM ( , EXTRACT(year FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM customer_table_src_10013.ds_partitioned) AS ds_partitioned__extract_doy , customer_table_src_10013.customer_name AS customer_id__customer_name , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned__day @@ -329,10 +329,10 @@ FROM ( , EXTRACT(year FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_year , EXTRACT(quarter FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter , EXTRACT(month FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week + , EXTRACT(isoweek FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_week , EXTRACT(day FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__extract_doy , customer_table_src_10013.customer_id FROM ***************************.customer_table customer_table_src_10013 ) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql index 83d7b73587..a6f0b3d5fc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multiple_metrics_no_dimensions__plan0.sql @@ -257,10 +257,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -269,10 +269,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -281,10 +281,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -294,10 +294,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -306,10 +306,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -318,10 +318,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -513,10 +513,10 @@ CROSS JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -525,10 +525,10 @@ CROSS JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -540,10 +540,10 @@ CROSS JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -552,10 +552,10 @@ CROSS JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql index 9037a9f0bb..189d129aa7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql @@ -170,10 +170,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -182,10 +182,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -194,10 +194,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -207,10 +207,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -219,10 +219,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -231,10 +231,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -399,10 +399,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -411,10 +411,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -423,10 +423,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -436,10 +436,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -448,10 +448,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -460,10 +460,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -640,10 +640,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -652,10 +652,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -664,10 +664,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -677,10 +677,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -689,10 +689,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -701,10 +701,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -879,10 +879,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -891,10 +891,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -903,10 +903,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -916,10 +916,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -928,10 +928,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -940,10 +940,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..f5af97ec20 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dayofweek FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATE_SUB(CAST(subq_7.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..3281174961 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dayofweek FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day + GROUP BY + metric_time__extract_dow + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql index 61c29db82f..34b763eb68 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql @@ -48,10 +48,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -60,10 +60,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -72,10 +72,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -85,10 +85,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -97,10 +97,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -109,10 +109,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql index 2fff30c78d..edb417b214 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql @@ -109,10 +109,10 @@ FROM ( , EXTRACT(year FROM id_verifications_src_10003.ds) AS ds__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds) AS ds__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds) AS ds__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds) AS ds__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS ds__extract_doy , id_verifications_src_10003.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS ds_partitioned__month @@ -121,10 +121,10 @@ FROM ( , EXTRACT(year FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS ds_partitioned__extract_doy , id_verifications_src_10003.verification_type , id_verifications_src_10003.ds AS verification__ds__day , DATE_TRUNC(id_verifications_src_10003.ds, isoweek) AS verification__ds__week @@ -134,10 +134,10 @@ FROM ( , EXTRACT(year FROM id_verifications_src_10003.ds) AS verification__ds__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds) AS verification__ds__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds) AS verification__ds__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds) AS verification__ds__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds) AS verification__ds__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds) AS verification__ds__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds) AS verification__ds__extract_doy , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned__day , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, isoweek) AS verification__ds_partitioned__week , DATE_TRUNC(id_verifications_src_10003.ds_partitioned, month) AS verification__ds_partitioned__month @@ -146,10 +146,10 @@ FROM ( , EXTRACT(year FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_year , EXTRACT(quarter FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_quarter , EXTRACT(month FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week + , EXTRACT(isoweek FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_week , EXTRACT(day FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__extract_doy , id_verifications_src_10003.verification_type AS verification__verification_type , id_verifications_src_10003.verification_id AS verification , id_verifications_src_10003.user_id AS user @@ -176,10 +176,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.ds) AS ds__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.ds) AS ds__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.ds) AS ds__extract_week , EXTRACT(day FROM users_ds_source_src_10007.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds) AS ds__extract_doy , users_ds_source_src_10007.created_at AS created_at__day , DATE_TRUNC(users_ds_source_src_10007.created_at, isoweek) AS created_at__week , DATE_TRUNC(users_ds_source_src_10007.created_at, month) AS created_at__month @@ -188,10 +188,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.created_at) AS created_at__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.created_at) AS created_at__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.created_at) AS created_at__extract_week , EXTRACT(day FROM users_ds_source_src_10007.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.created_at) AS created_at__extract_doy , users_ds_source_src_10007.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, month) AS ds_partitioned__month @@ -200,10 +200,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__extract_doy , users_ds_source_src_10007.home_state , users_ds_source_src_10007.ds AS user__ds__day , DATE_TRUNC(users_ds_source_src_10007.ds, isoweek) AS user__ds__week @@ -213,10 +213,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.ds) AS user__ds__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.ds) AS user__ds__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.ds) AS user__ds__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.ds) AS user__ds__extract_week , EXTRACT(day FROM users_ds_source_src_10007.ds) AS user__ds__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.ds) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds) AS user__ds__extract_doy , users_ds_source_src_10007.created_at AS user__created_at__day , DATE_TRUNC(users_ds_source_src_10007.created_at, isoweek) AS user__created_at__week , DATE_TRUNC(users_ds_source_src_10007.created_at, month) AS user__created_at__month @@ -225,10 +225,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_week , EXTRACT(day FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.created_at) AS user__created_at__extract_doy , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned__day , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, isoweek) AS user__ds_partitioned__week , DATE_TRUNC(users_ds_source_src_10007.ds_partitioned, month) AS user__ds_partitioned__month @@ -237,10 +237,10 @@ FROM ( , EXTRACT(year FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_year , EXTRACT(quarter FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_quarter , EXTRACT(month FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week + , EXTRACT(isoweek FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_week , EXTRACT(day FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__extract_doy , users_ds_source_src_10007.home_state AS user__home_state , users_ds_source_src_10007.user_id AS user FROM ***************************.dim_users users_ds_source_src_10007 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql index 791d0d4049..07e622e748 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -85,10 +85,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -98,10 +98,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql index 0f94ea6726..060f3efacd 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node__plan0_optimized.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM ds) AS account__ds__extract_week , EXTRACT(day FROM ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql index 1e815dd2dc..f13236380c 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -86,10 +86,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -99,10 +99,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql index a25638e888..8a36408f84 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM ds) AS account__ds__extract_week , EXTRACT(day FROM ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql index de371ca618..eff1adbdb9 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user @@ -86,10 +86,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS ds__extract_doy , accounts_source_src_10000.account_type , accounts_source_src_10000.ds AS account__ds__day , DATE_TRUNC(accounts_source_src_10000.ds, isoweek) AS account__ds__week @@ -99,10 +99,10 @@ INNER JOIN ( , EXTRACT(year FROM accounts_source_src_10000.ds) AS account__ds__extract_year , EXTRACT(quarter FROM accounts_source_src_10000.ds) AS account__ds__extract_quarter , EXTRACT(month FROM accounts_source_src_10000.ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM accounts_source_src_10000.ds) AS account__ds__extract_week , EXTRACT(day FROM accounts_source_src_10000.ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM accounts_source_src_10000.ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM accounts_source_src_10000.ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM accounts_source_src_10000.ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM accounts_source_src_10000.ds) AS account__ds__extract_doy , accounts_source_src_10000.account_type AS account__account_type , accounts_source_src_10000.user_id AS user , accounts_source_src_10000.user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql index 35af81c4d7..025caeebfc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -45,10 +45,10 @@ FROM ( , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , account_type , ds AS account__ds__day , DATE_TRUNC(ds, isoweek) AS account__ds__week @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM ds) AS account__ds__extract_year , EXTRACT(quarter FROM ds) AS account__ds__extract_quarter , EXTRACT(month FROM ds) AS account__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS account__ds__extract_week + , EXTRACT(isoweek FROM ds) AS account__ds__extract_week , EXTRACT(day FROM ds) AS account__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS account__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS account__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS account__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS account__ds__extract_doy , account_type AS account__account_type , user_id AS user , user_id AS account__user diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..031517a99c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..9ccede846b --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..ec4e2ef1e8 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week + , DATE_TRUNC(bookings_source_src_10001.ds, month) AS booking__ds__month + , DATE_TRUNC(bookings_source_src_10001.ds, quarter) AS booking__ds__quarter + , DATE_TRUNC(bookings_source_src_10001.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week + , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month + , DATE_TRUNC(bookings_source_src_10001.paid_at, quarter) AS booking__paid_at__quarter + , DATE_TRUNC(bookings_source_src_10001.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..1d96b88869 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(isoweek FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql index 794337f673..e01a0418ff 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql @@ -34,10 +34,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -46,10 +46,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -58,10 +58,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -71,10 +71,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -83,10 +83,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -95,10 +95,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -128,10 +128,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS ds__extract_doy , listings_latest_src_10004.created_at AS created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS created_at__month @@ -140,10 +140,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS created_at__extract_doy , listings_latest_src_10004.country AS country_latest , listings_latest_src_10004.is_lux AS is_lux_latest , listings_latest_src_10004.capacity AS capacity_latest @@ -155,10 +155,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__ds__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__ds__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__ds__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__ds__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__ds__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__ds__extract_doy , listings_latest_src_10004.created_at AS listing__created_at__day , DATE_TRUNC(listings_latest_src_10004.created_at, isoweek) AS listing__created_at__week , DATE_TRUNC(listings_latest_src_10004.created_at, month) AS listing__created_at__month @@ -167,10 +167,10 @@ LEFT OUTER JOIN ( , EXTRACT(year FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_year , EXTRACT(quarter FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_quarter , EXTRACT(month FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_month - , EXTRACT(ISOWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week + , EXTRACT(isoweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_week , EXTRACT(day FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_day - , EXTRACT(DAYOFWEEK FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow - , EXTRACT(DAYOFYEAR FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy + , EXTRACT(dayofweek FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_dow + , EXTRACT(dayofyear FROM listings_latest_src_10004.created_at) AS listing__created_at__extract_doy , listings_latest_src_10004.country AS listing__country_latest , listings_latest_src_10004.is_lux AS listing__is_lux_latest , listings_latest_src_10004.capacity AS listing__capacity_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql index 28daacf7ef..0ba3c40334 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql @@ -23,10 +23,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -35,10 +35,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -47,10 +47,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -60,10 +60,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -72,10 +72,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -84,10 +84,10 @@ SELECT , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql index b6c163b9eb..3e49f05f72 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql @@ -23,10 +23,10 @@ SELECT , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month @@ -35,10 +35,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month @@ -47,10 +47,10 @@ SELECT , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS paid_at__extract_week , EXTRACT(day FROM paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , is_instant AS booking__is_instant , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week @@ -60,10 +60,10 @@ SELECT , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM ds) AS booking__ds__extract_week , EXTRACT(day FROM ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month @@ -72,10 +72,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month @@ -84,10 +84,10 @@ SELECT , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql index d1740a6a39..79946c1bc1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_through_scd_dimension__plan0.sql @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql index 8abc633b9a..1cfb7780a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_hop_to_scd_dimension__plan0.sql @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql index 99d4dba7cb..0d1825bde4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql index d1740a6a39..79946c1bc1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql index 8abc633b9a..1cfb7780a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql index 99d4dba7cb..0d1825bde4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..a65895e8b1 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + subq_7.metric_time__day - INTERVAL 14 day = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..5f6ec1ee79 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql index d1740a6a39..79946c1bc1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_through_scd_dimension__plan0.sql @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql index 8abc633b9a..1cfb7780a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_hop_to_scd_dimension__plan0.sql @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql index 99d4dba7cb..0d1825bde4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..17b1104b28 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + subq_7.metric_time__day - MAKE_INTERVAL(days => 14) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..0ddba9f210 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql index d1740a6a39..79946c1bc1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_through_scd_dimension__plan0.sql @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql index 8abc633b9a..1cfb7780a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_hop_to_scd_dimension__plan0.sql @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql index 99d4dba7cb..0d1825bde4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql index d1740a6a39..79946c1bc1 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_through_scd_dimension__plan0.sql @@ -381,25 +381,25 @@ FROM ( -- 'ds__month', -- 'ds__quarter', -- 'ds__year', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', - -- 'ds__day', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_week', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', -- 'user__ds__day', -- 'user__ds__week', -- 'user__ds__month', -- 'user__ds__quarter', -- 'user__ds__year', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', - -- 'user__ds__day', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_week', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', -- 'user'] SELECT subq_4.ds__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql index 8abc633b9a..1cfb7780a7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_hop_to_scd_dimension__plan0.sql @@ -288,49 +288,49 @@ FROM ( -- 'window_start__month', -- 'window_start__quarter', -- 'window_start__year', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', - -- 'window_start__day', + -- 'window_start__extract_year', + -- 'window_start__extract_quarter', + -- 'window_start__extract_month', + -- 'window_start__extract_week', + -- 'window_start__extract_day', + -- 'window_start__extract_dow', + -- 'window_start__extract_doy', -- 'window_end__day', -- 'window_end__week', -- 'window_end__month', -- 'window_end__quarter', -- 'window_end__year', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', - -- 'window_end__day', + -- 'window_end__extract_year', + -- 'window_end__extract_quarter', + -- 'window_end__extract_month', + -- 'window_end__extract_week', + -- 'window_end__extract_day', + -- 'window_end__extract_dow', + -- 'window_end__extract_doy', -- 'lux_listing__window_start__day', -- 'lux_listing__window_start__week', -- 'lux_listing__window_start__month', -- 'lux_listing__window_start__quarter', -- 'lux_listing__window_start__year', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', - -- 'lux_listing__window_start__day', + -- 'lux_listing__window_start__extract_year', + -- 'lux_listing__window_start__extract_quarter', + -- 'lux_listing__window_start__extract_month', + -- 'lux_listing__window_start__extract_week', + -- 'lux_listing__window_start__extract_day', + -- 'lux_listing__window_start__extract_dow', + -- 'lux_listing__window_start__extract_doy', -- 'lux_listing__window_end__day', -- 'lux_listing__window_end__week', -- 'lux_listing__window_end__month', -- 'lux_listing__window_end__quarter', -- 'lux_listing__window_end__year', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', - -- 'lux_listing__window_end__day', + -- 'lux_listing__window_end__extract_year', + -- 'lux_listing__window_end__extract_quarter', + -- 'lux_listing__window_end__extract_month', + -- 'lux_listing__window_end__extract_week', + -- 'lux_listing__window_end__extract_day', + -- 'lux_listing__window_end__extract_dow', + -- 'lux_listing__window_end__extract_doy', -- 'lux_listing'] SELECT subq_4.window_start__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql index 99d4dba7cb..0d1825bde4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql @@ -252,25 +252,25 @@ FROM ( -- 'ds_partitioned__month', -- 'ds_partitioned__quarter', -- 'ds_partitioned__year', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', - -- 'ds_partitioned__day', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_week', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', -- 'customer_id__ds_partitioned__day', -- 'customer_id__ds_partitioned__week', -- 'customer_id__ds_partitioned__month', -- 'customer_id__ds_partitioned__quarter', -- 'customer_id__ds_partitioned__year', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', - -- 'customer_id__ds_partitioned__day', + -- 'customer_id__ds_partitioned__extract_year', + -- 'customer_id__ds_partitioned__extract_quarter', + -- 'customer_id__ds_partitioned__extract_month', + -- 'customer_id__ds_partitioned__extract_week', + -- 'customer_id__ds_partitioned__extract_day', + -- 'customer_id__ds_partitioned__extract_dow', + -- 'customer_id__ds_partitioned__extract_doy', -- 'customer_id'] SELECT subq_4.ds_partitioned__day diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql new file mode 100644 index 0000000000..68e1d3302c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql @@ -0,0 +1,585 @@ +-- Compute Metrics via Expressions +SELECT + subq_13.metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_4.metric_time__extract_dow, subq_12.metric_time__extract_dow) AS metric_time__extract_dow + , subq_4.bookings AS bookings + , subq_12.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow + ) subq_3 + ) subq_4 + INNER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_11.metric_time__extract_dow + , subq_11.bookings AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + SELECT + subq_10.metric_time__extract_dow + , SUM(subq_10.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_9.metric_time__extract_dow + , subq_9.bookings + FROM ( + -- Join to Time Spine Dataset + SELECT + EXTRACT(dow FROM subq_7.metric_time__day) AS metric_time__extract_dow + , subq_6.ds__day AS ds__day + , subq_6.ds__week AS ds__week + , subq_6.ds__month AS ds__month + , subq_6.ds__quarter AS ds__quarter + , subq_6.ds__year AS ds__year + , subq_6.ds__extract_year AS ds__extract_year + , subq_6.ds__extract_quarter AS ds__extract_quarter + , subq_6.ds__extract_month AS ds__extract_month + , subq_6.ds__extract_week AS ds__extract_week + , subq_6.ds__extract_day AS ds__extract_day + , subq_6.ds__extract_dow AS ds__extract_dow + , subq_6.ds__extract_doy AS ds__extract_doy + , subq_6.ds_partitioned__day AS ds_partitioned__day + , subq_6.ds_partitioned__week AS ds_partitioned__week + , subq_6.ds_partitioned__month AS ds_partitioned__month + , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_6.ds_partitioned__year AS ds_partitioned__year + , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_week AS ds_partitioned__extract_week + , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy + , subq_6.paid_at__day AS paid_at__day + , subq_6.paid_at__week AS paid_at__week + , subq_6.paid_at__month AS paid_at__month + , subq_6.paid_at__quarter AS paid_at__quarter + , subq_6.paid_at__year AS paid_at__year + , subq_6.paid_at__extract_year AS paid_at__extract_year + , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter + , subq_6.paid_at__extract_month AS paid_at__extract_month + , subq_6.paid_at__extract_week AS paid_at__extract_week + , subq_6.paid_at__extract_day AS paid_at__extract_day + , subq_6.paid_at__extract_dow AS paid_at__extract_dow + , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__day AS booking__ds__day + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_week AS booking__ds__extract_week + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy + , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day + , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week + , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month + , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter + , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year + , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year + , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter + , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month + , subq_6.booking__ds_partitioned__extract_week AS booking__ds_partitioned__extract_week + , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day + , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow + , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy + , subq_6.booking__paid_at__day AS booking__paid_at__day + , subq_6.booking__paid_at__week AS booking__paid_at__week + , subq_6.booking__paid_at__month AS booking__paid_at__month + , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter + , subq_6.booking__paid_at__year AS booking__paid_at__year + , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year + , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter + , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month + , subq_6.booking__paid_at__extract_week AS booking__paid_at__extract_week + , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day + , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow + , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.listing AS listing + , subq_6.guest AS guest + , subq_6.host AS host + , subq_6.booking__listing AS booking__listing + , subq_6.booking__guest AS booking__guest + , subq_6.booking__host AS booking__host + , subq_6.is_instant AS is_instant + , subq_6.booking__is_instant AS booking__is_instant + , subq_6.bookings AS bookings + , subq_6.instant_bookings AS instant_bookings + , subq_6.booking_value AS booking_value + , subq_6.max_booking_value AS max_booking_value + , subq_6.min_booking_value AS min_booking_value + , subq_6.bookers AS bookers + , subq_6.average_booking_value AS average_booking_value + , subq_6.referred_bookings AS referred_bookings + , subq_6.median_booking_value AS median_booking_value + , subq_6.booking_value_p99 AS booking_value_p99 + , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99 + , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99 + , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99 + FROM ( + -- Date Spine + SELECT + subq_8.ds AS metric_time__day + FROM ***************************.mf_time_spine subq_8 + ) subq_7 + INNER JOIN ( + -- Metric Time Dimension 'ds' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_week + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_week + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.paid_at__day + , subq_5.paid_at__week + , subq_5.paid_at__month + , subq_5.paid_at__quarter + , subq_5.paid_at__year + , subq_5.paid_at__extract_year + , subq_5.paid_at__extract_quarter + , subq_5.paid_at__extract_month + , subq_5.paid_at__extract_week + , subq_5.paid_at__extract_day + , subq_5.paid_at__extract_dow + , subq_5.paid_at__extract_doy + , subq_5.booking__ds__day + , subq_5.booking__ds__week + , subq_5.booking__ds__month + , subq_5.booking__ds__quarter + , subq_5.booking__ds__year + , subq_5.booking__ds__extract_year + , subq_5.booking__ds__extract_quarter + , subq_5.booking__ds__extract_month + , subq_5.booking__ds__extract_week + , subq_5.booking__ds__extract_day + , subq_5.booking__ds__extract_dow + , subq_5.booking__ds__extract_doy + , subq_5.booking__ds_partitioned__day + , subq_5.booking__ds_partitioned__week + , subq_5.booking__ds_partitioned__month + , subq_5.booking__ds_partitioned__quarter + , subq_5.booking__ds_partitioned__year + , subq_5.booking__ds_partitioned__extract_year + , subq_5.booking__ds_partitioned__extract_quarter + , subq_5.booking__ds_partitioned__extract_month + , subq_5.booking__ds_partitioned__extract_week + , subq_5.booking__ds_partitioned__extract_day + , subq_5.booking__ds_partitioned__extract_dow + , subq_5.booking__ds_partitioned__extract_doy + , subq_5.booking__paid_at__day + , subq_5.booking__paid_at__week + , subq_5.booking__paid_at__month + , subq_5.booking__paid_at__quarter + , subq_5.booking__paid_at__year + , subq_5.booking__paid_at__extract_year + , subq_5.booking__paid_at__extract_quarter + , subq_5.booking__paid_at__extract_month + , subq_5.booking__paid_at__extract_week + , subq_5.booking__paid_at__extract_day + , subq_5.booking__paid_at__extract_dow + , subq_5.booking__paid_at__extract_doy + , subq_5.ds__day AS metric_time__day + , subq_5.ds__week AS metric_time__week + , subq_5.ds__month AS metric_time__month + , subq_5.ds__quarter AS metric_time__quarter + , subq_5.ds__year AS metric_time__year + , subq_5.ds__extract_year AS metric_time__extract_year + , subq_5.ds__extract_quarter AS metric_time__extract_quarter + , subq_5.ds__extract_month AS metric_time__extract_month + , subq_5.ds__extract_week AS metric_time__extract_week + , subq_5.ds__extract_day AS metric_time__extract_day + , subq_5.ds__extract_dow AS metric_time__extract_dow + , subq_5.ds__extract_doy AS metric_time__extract_doy + , subq_5.listing + , subq_5.guest + , subq_5.host + , subq_5.booking__listing + , subq_5.booking__guest + , subq_5.booking__host + , subq_5.is_instant + , subq_5.booking__is_instant + , subq_5.bookings + , subq_5.instant_bookings + , subq_5.booking_value + , subq_5.max_booking_value + , subq_5.min_booking_value + , subq_5.bookers + , subq_5.average_booking_value + , subq_5.referred_bookings + , subq_5.median_booking_value + , subq_5.booking_value_p99 + , subq_5.discrete_booking_value_p99 + , subq_5.approximate_continuous_booking_value_p99 + , subq_5.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_5 + ) subq_6 + ON + DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day + ) subq_9 + ) subq_10 + GROUP BY + subq_10.metric_time__extract_dow + ) subq_11 + ) subq_12 + ON + ( + subq_4.metric_time__extract_dow = subq_12.metric_time__extract_dow + ) OR ( + ( + subq_4.metric_time__extract_dow IS NULL + ) AND ( + subq_12.metric_time__extract_dow IS NULL + ) + ) +) subq_13 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..d1a408e031 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0_optimized.sql @@ -0,0 +1,63 @@ +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks +FROM ( + -- Combine Metrics + SELECT + COALESCE(subq_18.metric_time__extract_dow, subq_26.metric_time__extract_dow) AS metric_time__extract_dow + , subq_18.bookings AS bookings + , subq_26.bookings_2_weeks_ago AS bookings_2_weeks_ago + FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_16 + GROUP BY + metric_time__extract_dow + ) subq_18 + INNER JOIN ( + -- Join to Time Spine Dataset + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + EXTRACT(dow FROM subq_22.ds) AS metric_time__extract_dow + , SUM(subq_20.bookings) AS bookings_2_weeks_ago + FROM ***************************.mf_time_spine subq_22 + INNER JOIN ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + SELECT + ds AS metric_time__day + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_20 + ON + DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day + GROUP BY + EXTRACT(dow FROM subq_22.ds) + ) subq_26 + ON + ( + subq_18.metric_time__extract_dow = subq_26.metric_time__extract_dow + ) OR ( + ( + subq_18.metric_time__extract_dow IS NULL + ) AND ( + subq_26.metric_time__extract_dow IS NULL + ) + ) +) subq_27 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql new file mode 100644 index 0000000000..3869c341c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0.sql @@ -0,0 +1,227 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_dow + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_dow + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + subq_1.metric_time__extract_dow + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_dow +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql new file mode 100644 index 0000000000..33b25a725c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_date_part__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_dow + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time__extract_dow'] + SELECT + EXTRACT(dow FROM ds) AS metric_time__extract_dow + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_dow diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql new file mode 100644 index 0000000000..b1321ec748 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0.sql @@ -0,0 +1,258 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.metric_time__extract_year + , subq_3.metric_time__extract_quarter + , subq_3.metric_time__extract_month + , subq_3.metric_time__extract_week + , subq_3.metric_time__extract_day + , subq_3.metric_time__extract_dow + , subq_3.metric_time__extract_doy + , subq_3.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + subq_1.metric_time__extract_year + , subq_1.metric_time__extract_quarter + , subq_1.metric_time__extract_month + , subq_1.metric_time__extract_week + , subq_1.metric_time__extract_day + , subq_1.metric_time__extract_dow + , subq_1.metric_time__extract_doy + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + 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_week + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_week + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_week + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_week + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_week + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_week + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_week AS metric_time__extract_week + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_10001.booking_value AS median_booking_value + , bookings_source_src_10001.booking_value AS booking_value_p99 + , bookings_source_src_10001.booking_value AS discrete_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_10001.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds AS ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , bookings_source_src_10001.is_instant AS booking__is_instant + , bookings_source_src_10001.ds AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(week FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , bookings_source_src_10001.paid_at AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_10001.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month + , EXTRACT(week FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dow FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.listing_id AS booking__listing + , bookings_source_src_10001.guest_id AS booking__guest + , bookings_source_src_10001.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time__extract_year + , subq_2.metric_time__extract_quarter + , subq_2.metric_time__extract_month + , subq_2.metric_time__extract_week + , subq_2.metric_time__extract_day + , subq_2.metric_time__extract_dow + , subq_2.metric_time__extract_doy +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql new file mode 100644 index 0000000000..402fb4f517 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_simple_query_with_multiple_date_parts__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Semantic Model 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'metric_time__extract_week', + -- 'metric_time__extract_month', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_year'] + SELECT + EXTRACT(year FROM ds) AS metric_time__extract_year + , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter + , EXTRACT(month FROM ds) AS metric_time__extract_month + , EXTRACT(week FROM ds) AS metric_time__extract_week + , EXTRACT(day FROM ds) AS metric_time__extract_day + , EXTRACT(dow FROM ds) AS metric_time__extract_dow + , EXTRACT(doy FROM ds) AS metric_time__extract_doy + , 1 AS bookings + FROM ***************************.fct_bookings bookings_source_src_10001 +) subq_6 +GROUP BY + metric_time__extract_year + , metric_time__extract_quarter + , metric_time__extract_month + , metric_time__extract_week + , metric_time__extract_day + , metric_time__extract_dow + , metric_time__extract_doy diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml index 63e2148484..ff39aa7c9b 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml @@ -1434,35 +1434,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml index a013e8d8c1..ce6f655f22 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml @@ -1054,59 +1054,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml index 4a1df37c68..188f6f7b0d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml @@ -906,37 +906,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml new file mode 100644 index 0000000000..81d5db4a69 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_offset_window_with_date_part__plan0.xml @@ -0,0 +1,2165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml new file mode 100644 index 0000000000..49d52f7aae --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_date_part__plan0.xml @@ -0,0 +1,863 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml new file mode 100644 index 0000000000..f987f53071 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_simple_query_with_multiple_date_parts__plan0.xml @@ -0,0 +1,966 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql index 66b9a92b39..ab0edb4ad2 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -119,10 +119,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -131,10 +131,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -143,10 +143,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -156,10 +156,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -168,10 +168,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -180,10 +180,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql index cfaecd587b..2b917da7a9 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -9,10 +9,10 @@ SELECT , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month @@ -21,10 +21,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month @@ -33,10 +33,10 @@ SELECT , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS paid_at__extract_week , EXTRACT(day FROM paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week , DATE_TRUNC(ds, month) AS booking__ds__month @@ -45,10 +45,10 @@ SELECT , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM ds) AS booking__ds__extract_week , EXTRACT(day FROM ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month @@ -57,10 +57,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month @@ -69,10 +69,10 @@ SELECT , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , paid_at AS metric_time__day , DATE_TRUNC(paid_at, isoweek) AS metric_time__week , DATE_TRUNC(paid_at, month) AS metric_time__month @@ -81,10 +81,10 @@ SELECT , EXTRACT(year FROM paid_at) AS metric_time__extract_year , EXTRACT(quarter FROM paid_at) AS metric_time__extract_quarter , EXTRACT(month FROM paid_at) AS metric_time__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS metric_time__extract_week + , EXTRACT(isoweek FROM paid_at) AS metric_time__extract_week , EXTRACT(day FROM paid_at) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS metric_time__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS metric_time__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql index 9895b04f88..58b676e2ff 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -131,10 +131,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -143,10 +143,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -155,10 +155,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -168,10 +168,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -180,10 +180,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -192,10 +192,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql index 9e14d2f83b..6290ee58d6 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -9,10 +9,10 @@ SELECT , EXTRACT(year FROM ds) AS ds__extract_year , EXTRACT(quarter FROM ds) AS ds__extract_quarter , EXTRACT(month FROM ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS ds__extract_week + , EXTRACT(isoweek FROM ds) AS ds__extract_week , EXTRACT(day FROM ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS ds__extract_doy , ds_partitioned AS ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS ds_partitioned__month @@ -21,10 +21,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS ds_partitioned__extract_doy , paid_at AS paid_at__day , DATE_TRUNC(paid_at, isoweek) AS paid_at__week , DATE_TRUNC(paid_at, month) AS paid_at__month @@ -33,10 +33,10 @@ SELECT , EXTRACT(year FROM paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS paid_at__extract_week , EXTRACT(day FROM paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS paid_at__extract_doy , ds AS booking__ds__day , DATE_TRUNC(ds, isoweek) AS booking__ds__week , DATE_TRUNC(ds, month) AS booking__ds__month @@ -45,10 +45,10 @@ SELECT , EXTRACT(year FROM ds) AS booking__ds__extract_year , EXTRACT(quarter FROM ds) AS booking__ds__extract_quarter , EXTRACT(month FROM ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM ds) AS booking__ds__extract_week , EXTRACT(day FROM ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM ds) AS booking__ds__extract_doy , ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(ds_partitioned, month) AS booking__ds_partitioned__month @@ -57,10 +57,10 @@ SELECT , EXTRACT(year FROM ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM ds_partitioned) AS booking__ds_partitioned__extract_doy , paid_at AS booking__paid_at__day , DATE_TRUNC(paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(paid_at, month) AS booking__paid_at__month @@ -69,10 +69,10 @@ SELECT , EXTRACT(year FROM paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM paid_at) AS booking__paid_at__extract_doy , ds AS metric_time__day , DATE_TRUNC(ds, isoweek) AS metric_time__week , DATE_TRUNC(ds, month) AS metric_time__month @@ -81,10 +81,10 @@ SELECT , EXTRACT(year FROM ds) AS metric_time__extract_year , EXTRACT(quarter FROM ds) AS metric_time__extract_quarter , EXTRACT(month FROM ds) AS metric_time__extract_month - , EXTRACT(ISOWEEK FROM ds) AS metric_time__extract_week + , EXTRACT(isoweek FROM ds) AS metric_time__extract_week , EXTRACT(day FROM ds) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK FROM ds) AS metric_time__extract_dow - , EXTRACT(DAYOFYEAR FROM ds) AS metric_time__extract_doy + , EXTRACT(dayofweek FROM ds) AS metric_time__extract_dow + , EXTRACT(dayofyear FROM ds) AS metric_time__extract_doy , listing_id AS listing , guest_id AS guest , host_id AS host diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql index 599746d204..24e3bb6ff9 100644 --- a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/BigQuery/test_simple_query_with_metric_time_dimension__plan0.sql @@ -153,10 +153,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -165,10 +165,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -177,10 +177,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -190,10 +190,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -202,10 +202,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -214,10 +214,10 @@ FROM ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host @@ -370,10 +370,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS ds__extract_doy , bookings_source_src_10001.ds_partitioned AS ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS ds_partitioned__month @@ -382,10 +382,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS paid_at__month @@ -394,10 +394,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS paid_at__extract_doy , bookings_source_src_10001.is_instant AS booking__is_instant , bookings_source_src_10001.ds AS booking__ds__day , DATE_TRUNC(bookings_source_src_10001.ds, isoweek) AS booking__ds__week @@ -407,10 +407,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds) AS booking__ds__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds) AS booking__ds__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds) AS booking__ds__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds) AS booking__ds__extract_doy , bookings_source_src_10001.ds_partitioned AS booking__ds_partitioned__day , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, isoweek) AS booking__ds_partitioned__week , DATE_TRUNC(bookings_source_src_10001.ds_partitioned, month) AS booking__ds_partitioned__month @@ -419,10 +419,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_week , EXTRACT(day FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.ds_partitioned) AS booking__ds_partitioned__extract_doy , bookings_source_src_10001.paid_at AS booking__paid_at__day , DATE_TRUNC(bookings_source_src_10001.paid_at, isoweek) AS booking__paid_at__week , DATE_TRUNC(bookings_source_src_10001.paid_at, month) AS booking__paid_at__month @@ -431,10 +431,10 @@ FULL OUTER JOIN ( , EXTRACT(year FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_year , EXTRACT(quarter FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_quarter , EXTRACT(month FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_month - , EXTRACT(ISOWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week + , EXTRACT(isoweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_week , EXTRACT(day FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_day - , EXTRACT(DAYOFWEEK FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow - , EXTRACT(DAYOFYEAR FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy + , EXTRACT(dayofweek FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_10001.paid_at) AS booking__paid_at__extract_doy , bookings_source_src_10001.listing_id AS listing , bookings_source_src_10001.guest_id AS guest , bookings_source_src_10001.host_id AS host diff --git a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt index 11a7d2fd95..3abcc19d22 100644 --- a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt +++ b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt @@ -1,24 +1,24 @@ ['company__ds__day', - 'company__ds__day', - 'company__ds__day', - 'company__ds__day', - 'company__ds__day', - 'company__ds__day', - 'company__ds__day', - 'company__ds__day', + 'company__ds__extract_day', + 'company__ds__extract_dow', + 'company__ds__extract_doy', + 'company__ds__extract_month', + 'company__ds__extract_quarter', + 'company__ds__extract_week', + 'company__ds__extract_year', 'company__ds__month', 'company__ds__quarter', 'company__ds__week', 'company__ds__year', 'company__user', 'ds__day', - 'ds__day', - 'ds__day', - 'ds__day', - 'ds__day', - 'ds__day', - 'ds__day', - 'ds__day', + 'ds__extract_day', + 'ds__extract_dow', + 'ds__extract_doy', + 'ds__extract_month', + 'ds__extract_quarter', + 'ds__extract_week', + 'ds__extract_year', 'ds__month', 'ds__quarter', 'ds__week', @@ -26,13 +26,13 @@ 'txn_revenue', 'user', 'user__ds__day', - 'user__ds__day', - 'user__ds__day', - 'user__ds__day', - 'user__ds__day', - 'user__ds__day', - 'user__ds__day', - 'user__ds__day', + 'user__ds__extract_day', + 'user__ds__extract_dow', + 'user__ds__extract_doy', + 'user__ds__extract_month', + 'user__ds__extract_quarter', + 'user__ds__extract_week', + 'user__ds__extract_year', 'user__ds__month', 'user__ds__quarter', 'user__ds__week',